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


in reply to Not able to release memory

Just a couple of random extra thoughts that may be of interest. To find the memory usage of Perl variables, try the Devel::Size module (by a very distinguished and busy Perl-6 architect, I see;-) and Devel::Peek.

To pre-size a hash, use the keys function as a l-value; see perldoc -f keys for details. That is, if you know in advance that the hash is going to be very big, pre-sizing it will certainly improve speed, and may improve memory usage a little (untested).