[mod_python] extreme memory usage with apache2

Lee Brown administrator at leebrown.org
Tue Sep 13 19:01:53 EDT 2005

It seems like each new request ought to be instantiating a new webObject
instance, yet it also seems that each new instantiation has a copy of all
the previous instance's data.  Are you sure you're not writing your data
into the webObject base class by mistake?
If that's not the case, you might try manually garbage-collecting the
response instance just prior to the end of your handler routine.

Best Regards,
Lee E. Brown
(administrator at leebrown.org)



From: mod_python-bounces at modpython.org
[mailto:mod_python-bounces at modpython.org] On Behalf Of mauchi
Sent: Tuesday, September 13, 2005 11:57 AM
To: mod_python at modpython.org
Subject: [mod_python] extreme memory usage with apache2

I've noticed this behaviour as of late which causes large memory usage in
apache2, rogue threads taking up 400+ megs for each client that eventually
cause me to restart apache:

I return all html content through a python object which handles the form
data and tracks errors

#    Init object and parse form
response = webObject(req)

#    return html or xml based on form entries

#    print debugging information

the object has an internal array called errors where I store debugging
information from the internal functions. What I expect is 1-2 lines of
messages for each time the page is loaded which is printed at the bottom of
the page. What I find is if I keep hitting refresh, that the lines grow each
time with the previous load's messages. 50 refreshes later I'll have 50-100
lines of debugging information. This makes me think that the webObject is
staying in memory between loads and doesn't get destroyed unt il I restart
apache2. This has become more of a problem as each client page now requests
frequent xml updates and the server quickly tires out.
If anyone has a suggestion on how to either: turn off said behaviour in
mod_python, destroy objects from memory, or a clever way to flush out all of
an object's internal data between loads, I would be most happy.

Thanks to all in advance!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050913/6eade7b3/attachment.html

More information about the Mod_python mailing list