[mod_python] Help with memory problems

dharana dharana at dharana.net
Tue Jul 12 19:29:43 EDT 2005

look at this screenshot:


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:


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.



More information about the Mod_python mailing list