Dear Ladies and Gentlemen,

I am writing to ask for your advice on dealing with memory leaks in an 
application that embeds a persistent Perl interpreter.

The embedding is basically copied from that described by the example 
programs persistent.pl (and persistent.c) from perldoc perlembed.

The problem is that the application size increases by 2-5 times after a 
month of running (the application is a service monitor) and since the 
application forks frequently (may O(1)/minute), the impact is more 
obvious.

I think the problem is that the application is leaking memory somehow 
through the Perl interpreter (the application compiled without Perl does 
not increase its memory usage so obviously).

My options seem to be 

. try and understand how mod_perl is organised and look for explicit 
tactics it uses to minimise leaks

. re-instantiate the Perl interpreter periodically

. avoid caching the compiled Perl program (or flush the cache 
periodically)

Unfortunately I have no idea how to instrument the application to even
work out what is breaking.

The application cache stores the Perl program modification time to avoid 
re-eval'ing the code each time it is run as long as the source hasn't 
changed.

Perl version is variable. The application seems to show this fault with 
5.005_03, 5.6.x and possibly 5.8.0.

Your comments re most welcome.

Thank you,

Yours sincerely.

 -- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.

Reply via email to