[OT] finding memory hungry bits of my code

Mark Blackman mark at blackmans.org
Thu Apr 9 13:26:08 BST 2009


On 9 Apr 2009, at 12:31, Edmund von der Burg wrote:

> 2009/4/9 Joel Bernstein <joel at fysh.org>:
>> Can you give some more information as to the nature of the code and  
>> its
>> naughtiness?
>
> I don't think that it is a memory leak - the size tends to remain
> constant after a few requests (it's a webapp - Catalyst under
> mod_perl).
>
> I reckon that most likely we're doing lots of innocent little bits of
> in-memory caching which all add up to lots of memory getting used. Or
> we're using certain modules that just swell up. Ideally we'd find
> which bits of code lead to the memory being consumed so that we'd get
> a list of places to look at first.
>
> The aim is not to make our code super slim, but rather find the worst
> memory offenders and fix them.
>
> Any and all hints and tips gratefully received.

Make sure get all your modules preloaded in the apache parent via  
PerlRequire
and a small script that helps trigger all the loading. i.e.

http://search.cpan.org/~dougm/mod_perl-1.27/mod_perl_tuning.pod#REDUCING_MEMORY_USE

You may already be doing this of course. I think Catalyst effectively  
does this
for you though via the 'PerlModule MyApp' directive you almost  
certainly already
have in your apache conf.

- Mark





More information about the london.pm mailing list