memory usage in mod_perl

David Miller justdave at bugzilla.org
Wed Jan 17 00:53:19 UTC 2007


Max Kanat-Alexander wrote on 1/16/07 6:11 PM:
> 	The usual solution for this is to set MaxRequestsPerChild.

Yeah, I've been doing that.  It started out at 4000.  I've cut it in 
half every time the machine got close (or passed) exhausting memory. 
It's down to 100 now.  (It was at 250 last time it crashed).

>>> If anyone has any ideas where to look or how to debug it, that'd be
>>> great, but it kinda smells like something's leaking.
> 
> 	When perl allocates memory for a variable, it doesn't release
> it. Ever. Until it dies.
> 
> 	But in mod_perl, it never dies! So, say somebody loads a list
> of 10,000 bugs. The memory for that 10,000 bugs is never released by
> the perl interpreter, even though it destroys the variable when the
> script exits.
> 
> 	If you know what specific variable is causing the problem, you
> can "undef $var" before your subroutine exits, and that can handle it.
> But you have to specifically undef it for perl to release it.

I was guessing that's probably what it was.  We don't have a whole lot 
of variables that are likely to occupy huge amounts of memory.  A 
buglist is a darn good candidate.  A good start would probably be 
undef'ing the bug object cache in our cleanup handler.

-- 
Dave Miller                                   http://www.justdave.net/
System Administrator, Mozilla Corporation      http://www.mozilla.com/
Project Leader, Bugzilla Bug Tracking System  http://www.bugzilla.org/



More information about the developers mailing list