
aw at ice-sa
Jun 12, 2009, 4:32 AM
Post #3 of 5
(896 views)
Permalink
|
|
Re: Figuring out which perl file is leaking memory
[In reply to]
|
|
Michael Gardner wrote: > William T wrote: >> There are some leak analysis modules that may help (Devel::Leak I >> think). I've tried using them in the past, but they haven't worked >> well for me for various reasons. I found commenting out early branch >> points allowed me (most of the time) to narrow down where the leak was >> actually happening. The I typically look fr anything that looks like >> a closure or some code playing with references. > > Rolf Banting wrote: >> There's a few modules on CPAN that might help e.g. Devel::LeakTrace. > > The problem is that there are a lot of perl files to check out, and I > don't know which one has the leak. What I'm asking is whether there's a > way to figure out *which file* is leaking memory, without having to test > each file individually. Some kind of per-file memory usage statistics > from modperl or somesuch. > I don't think there is an /easy/ way, but maybe something along these lines : I believe mod_perl redefines a number of things, such as exit(), return() etc.. Maybe you could re-redefine them, and arrange to call something there which would give you some info ? That could be done, for example, in your startup.pl script (the one you execute when starting the server and initially loading mod_perl).
|