finding memory leaks

finding memory leaks

am 10.08.2009 22:35:41 von E R

Hi,

What's the best way to find memory leaks in a mod_perl app? I am
trying to use Apache::Leak with mod_perl 1.41

Some notes:

1. My mod_perl app is *HUGE*. Apache::Leak reports over 500,000 SVs. I
think the time it takes to traverse the symbol tables is long enough
to time out my browser (I'm seeing the output from what looks like a
second request or an error handler.)

2. Should I compile perl with any special options, like DEBUG?
Apache::Leak reports I am leaking ~50 SVs, and I see a lot of "old"
messages, but not a lot of other useful information to track down the
leakage.

3. I'm putting the leak detection code right around my handler
function (which I've renamed to 'real_handler')

sub handler {
my @args = @_;
my $response;
leak_test {
$response = real_handler(@args);
};
$response;
}

sub real_handler { ... } # original handler routine

Any issues with that?

Thanks,

ER

Re: finding memory leaks

am 10.08.2009 22:39:32 von Perrin Harkins

On Mon, Aug 10, 2009 at 4:35 PM, E R wrote:
> What's the best way to find memory leaks in a mod_perl app?

What problem are you trying to solve? Is your app just growing? If
so, that's probably not a leak. You're most likely just using memory.
There are many tips for analyzing and reducing memory use, both in
the mod_perl docs and the book at http://modperlbook.org/.

- Perrin