[XML-SIG] PyXML API problem

Fred L. Drake, Jr. fdrake at acm.org
Tue Jul 15 18:29:38 EDT 2003


Kamel Hamard writes:
 > - Before receiving the queries, I take a look to the memory used by my
 > server and I see that its 9 Megs 
 > 
 > - When the server starts processing the first audit the memory grows up to
 > 36 Megs 

With just this information, it's impossible to know whether this is a
leak or not.  Depending on the application, there may be a lot of
delayed imports that get loaded on the first request, and the memory
contains imported Python modules, libraries, message catalogs, or the
like.  Figuring it out would require your application code and version
information on the libraries.  And a chunk of time.  ;-)

 > - Is it normal that a dom takes all this memory ? 

DOM implementations have an incredible tendency to be memory hogs.
It's possible to do things to cut back on this, but they tend to be an
amazing amount of work and can impact other aspect of the application
as well, depending on the approach taken.

 > I was using 4Suite API and I found a memory leak. Its why I'm using PyXML
 > now, Its slower and it takes more memory. 

Are you saying PyXML is slower and uses more memory, or 4Suite?  What
version of PyXML?  (I'm sure you've stated it in the thread; I just
don't recall.)


Tim Diggins writes:
 > DOM objects are notorious for having cyclic references and thus preventing
 > garbage collection. Are you breaking this dependency and deleting the DOM
 > objects when you're finished with them?
 >  
 > Apologies if this is no longer relevant with the 2.x garbage collector. I
 > still delete things to free up memory when I'm feeling nervous and am not
 > sure when I'm doing it unnecessarily.

It's not necessary with the new collector, but it's still a good idea
to free the resource when you're done with it.  The collector will
handle it, but may not do so at a predictable time.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation



More information about the XML-SIG mailing list