RusselB commented on a Page, Colour Defender  -  Mar 27, 2009

No. The number at the end of the /hmake statement is the number of slots that are opened, not the amount of memory that is allocated.
Even if it was the amount of memory, your code should look like this

alias counthash {
  var %a = $hget(0), %c
  while %a {
    inc %c $hget(%a).size
    dec %a
  $iif($isid,return,echo -a) %c

While this is closer to the amount of memory actually, there's still a discrepancy, since the number of slots specified in the /hmake statement is usually about 1/10th of the number of items you think you're going to have, also the fact that an entry that has 400 characters in it is going to need more memory to hold the information than an entry of 10 characters (for example.)

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.