Eugene Toropov wrote:
Greetings,
We have a problem with huge Apache+mod_perl2 processes of 150-200 Mb in size. After apache restart they are usually 40-50 Mb in size, then in a minute grow up to 100-150 Mb and then some time later may grow up to 200 Mb.
One basic characteristic of Perl's memory management is that, once it has acquired a
certain amount of memory from the OS under which it runs, it never gives it back to the OS.
For stand-alone perl scripts, this rarely matters, as when the script terminates, the perl
interpreter process also terminates, and the memory it used is then returned to the OS.
But under apache/mod_perl, the same perl interpreter stays alive as long as the apache
process (e.g., an apache child process) in which it runs is alive.
So over time, if your perl scripts/modules are not a bit careful, the amount of memory
used can grow and grow.
Inside of perl itself, the memory used by scripts and modules is normally reclaimed and
recycled. But perl's "garbage collector" can only recycle the memory used by a variable
if there are no more references to that variable.