alex_rayan has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
When I create and load a hash, I can see the memory usage "using top"
But when I remove the keys from the hash, top doesnt indicate the decrease in memory.I tried, "undef %hash" ,but still no decrease. I need to know, when the memory gets released.
Thanx
-Alex

Replies are listed 'Best First'.
Re: When memory gets released?
by archon (Monk) on Mar 03, 2001 at 04:53 UTC
    The memory will be 'released' when the process exits. Process sizes, as a rule, don't get smaller. The memory is allocated when you create the hash. If you delete it, the memory still belongs to the perl instance which can then reuse that memory for other things.

    HTH, HAND.

Re: When memory gets released?
by rpc (Monk) on Mar 03, 2001 at 04:55 UTC
    You can't free the memory. There is no definite way to know when it is free'd: See this node.