I'm experiencing bad memory leaks in my ZServer-based system. I recently upgraded from 2.0.0 to 2.2.1. I didn't have leakage using 2.0.0 - certainly nothing like I'm seeing it now. When I call the same method (same parameters as well) over and over, I pretty significant leakage via isolate methods exposed through ZServer to test scripts that don't use ZServer, no leakage occurs, so I'm beginning to think there's something amiss with ZServer or DocumentTemplate (the two pieces I use most heavily) or the parts they use. Unfortunately, even disconnected from ZServer, my code is still pretty dependent on my own environment so I can't easily post a script for people to gaze at. One simple method (just executes a DocumentTemplate and returns the resulting HTML) seems to be growing at a rate of about 16kbytes every five to ten times it's called. A search method that calls an XML-RPC server to do the work is much worse, growing at a rate of 85kbytes to 100kbytes per call. It's certainly possible that I'm creating some garbage that Python's reference counting can't reclaim, but when I run my server under Python 2.0b1 with the new garbage collector enabled (and collecting at each call) it never finds anything to collect, so it would appear that the garbage is either being created at a lower level (non-Python heap allocations in C code) or Python objects are getting appended to lists or dicts that are visible to some part of the system (just not obvious to me). What tools are available to try and detect memory leaks in Zope-ish applications? What input can I provide to DC or other interested experts to help track this down? Thx, -- Skip Montanaro (skip@mojam.com) http://www.mojam.com/ http://www.musi-cal.com/
Skip Montanaro wrote:
I'm experiencing bad memory leaks in my ZServer-based system. I recently upgraded from 2.0.0 to 2.2.1. I didn't have leakage using 2.0.0 - certainly nothing like I'm seeing it now. When I call the same method (same parameters as well) over and over, I pretty significant leakage via isolate methods exposed through ZServer to test scripts that don't use ZServer, no leakage occurs, so I'm beginning to think there's something amiss with ZServer or DocumentTemplate (the two pieces I use most heavily) or the parts they use. Unfortunately, even disconnected from ZServer, my code is still pretty dependent on my own environment so I can't easily post a script for people to gaze at. One simple method (just executes a DocumentTemplate and returns the resulting HTML) seems to be growing at a rate of about 16kbytes every five to ten times it's called. A search method that calls an XML-RPC server to do the work is much worse, growing at a rate of 85kbytes to 100kbytes per call.
any noticeable differences if you flush the cache?
It's certainly possible that I'm creating some garbage that Python's reference counting can't reclaim, but when I run my server under Python 2.0b1 with the new garbage collector enabled (and collecting at each call) it never finds anything to collect, so it would appear that the garbage is either being created at a lower level (non-Python heap allocations in C code) or Python objects are getting appended to lists or dicts that are visible to some part of the system (just not obvious to me).
What tools are available to try and detect memory leaks in Zope-ish applications? What input can I provide to DC or other interested experts to help track this down?
Thx,
You might want to check the ref count info at www.nightmare.com/medusa some notes from the pywx group (pywx.sourceforge.net) that might be helpful """ `intern'ed Python strings are shared process-wide, so there would be a memory leak if varying strings would get interned. You can get more information from the Python documentation for the built-in function `intern()'. Scripts running under PyWX can, of course, also cause memory leaks if they create circular references (unfreeable by Python's reference-counting scheme) or import buggy C extension modules. """ I hope thats somewhat helpful Cheers Kapil
participants (2)
-
Kapil Thangavelu -
Skip Montanaro