There's more than one way to do things | |
PerlMonks |
Re^2: Memory utilization and hashesby QM (Parson) |
on Jan 26, 2018 at 10:16 UTC ( [id://1207941]=note: print w/replies, xml ) | Need Help?? |
I don't think delete shrinks the hash per se. Certain hash admin is performed to mark hash entries unused, etc. Some linked memory (references) may become free.
But the only way to shrink the hash is to make a new hash, and copy over the "trimmed" old hash, and then throw away the old hash. You should be able to make a test case for this, showing the size of a hash does not shrink after deletes, and that total process memory doesn't shrink, but only grows. It is up to you and Perl to make efficient use of an ever growing pile of memory allocated by the OS. -QM
In Section
Seekers of Perl Wisdom
|
|