There's more than one way to do things | |
PerlMonks |
Long running tasks, perl and garbage collectionby GoCool (Scribe) |
on May 20, 2009 at 19:11 UTC ( [id://765312]=perlquestion: print w/replies, xml ) | Need Help?? |
GoCool has asked for the wisdom of the Perl Monks concerning the following question:
This very simple and seemingly trivial task of illustrating perl's garbage collection seems to exhibit the most unexpected results and I'm clueless as to why. One would expect to find a reduction in the RSS of the process when a huge hash is deallocated, undef'd *and* goes out of scope but far from decreasing, the RSS seems to have increased in the end. Why isn't it being garbage collected when it goes out of scope? When exactly is the hash garbage collected by perl? If the answer is when the program exits, then it seems like we'd have bigger problems when dealing with long running processes such as mod_perl. One plausible explanation could be that even though perl actually garbage collects it, it's not released to the OS to be reclaimed just yet. If that is indeed the case then it seems like long running tasks/processes like mod_perl continually grow in size until that particular apache/mod_perl http process is killed/terminated. What am I missing here? Any insights appreciated.
-GoCool
Back to
Seekers of Perl Wisdom
|
|