[mod_python] Help with memory problems

dharana dharana at dharana.net
Tue Jul 12 19:49:24 EDT 2005

Please, ignore my previous email. The massive leak was being caused by 
FileSession. I was using an earlier snapshot and after upgrading to:


Everything went back normal. After checking everything works go upgrade 
production. Load problem solved. I feel much better now, python handles the 
heavy complexity I imposed to him with no problems.

How much is left for 3.2? I can't use an stable mp release right now because I 
need several things included in 3.2 (segfaults for psp, filesession, etc) and 
using svn HEAD in a prod server is scary.

dharana wrote:
> look at this screenshot:
> http://dharana.net/memory_concerns.png
> It shows two screenshots of the same page of my webapp. The lower one 
> was shoot just after an apachectl start. The second one was shot after 6 
> consecutive refreshes where memory usage increased every time by a lot 
> of Mbs.
> I use a lot of custom modules, from db calls to xslt transformations 
> (with libxml). But in the page shown in the screenshot it does little. 
> The strange thing is that after a few more page refreshes the memory 
> load goes back to 23Mb and then increases again.
> I use some light module-level caching (I cache the 3 queries executed in 
> the lower page). But I don't think this is causing the heavy memory 
> usage because after it goes back to 23Mb it does query again (ie: the 
> caching mechanism still has it's cache).
> I use apache prefork and Maxrequestperchild 0. After every page refresh 
> the unr obj var shown on the page doesn't changes. It's either 63 or 0.
> mem, resident and stack come from this script:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
> unr obj is just the output of gc.collect() after everything else is done 
> (the debug print is printed just before return apache.OK.
> What I am asking is for some help or pointers in how to track down who 
> is causing this or where to look for reducing the memory usage.
> Thanks,


More information about the Mod_python mailing list