Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Ok, there are a few things. First as others have commented the OS manages allocating and freeing memory, and typically doesnt bother. But with modern OS'es swapping etc, im not sure why it should be a problem, maybe on *nix its different to win32. Second you are creating 1000 * 100 * 100 keys, which means 10,000,000 keys, which also means a hash stucture of 16,777,216 value slots as internally there will always be next power of 2 value slots vs keys. The best way to reduce the memory footprint of something like this is to use a DB or a hash tied to a DB of some form, possibly cached by a real hash for speed on frequent fetches. A tied DB_File B+Tree is often a reasonable option. Third your style is ah, very C like. :-)
HTH
---
demerphq First they ignore you, then they laugh at you, then they fight you, then you win.
In reply to Re: Not able to release memory
by demerphq
|
|