http://www.perlmonks.org?node_id=1006741


in reply to Memory issue with Hash

I'm asking this becuase undefing the hash or reseting ( undef %hash or hash = () ) doesn't release the memory.

Prove it! (Ie. demonstrate your claim by posting working code; because what you claim is not normally true.)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^2: Memory issue with Hash
by Anonymous Monk on Dec 03, 2012 at 04:24 UTC
    Should be obvious enough... Emptying or undef'ing a hash might or might not set the reference-count of the objects in question to zero. And even if it does, garbage collection might not occur immediately. So the statement is quite pragmatically correct: you can zap a hash, check the memory allocation immediately thereafter, and find that nothing at all has changed. Yet. If the OP finds that memory is not being released, odds are quite good that there are circular references going on here which haven't been weakened.
      Should be obvious enough...

      Guess on if you like. I'll wait for the evidence.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong