[Zope-dev] XMLDocument appears to leak memory

Martijn Faassen m.faassen@vet.uu.nl
Thu, 02 Sep 1999 17:22:49 +0200


Martijn Faassen wrote:
> 
> Amos Latteier wrote:

> > Well, I suppose that it is possible there are memory leaks in XML
> > Document, however I'd like to see stronger evidence before I jump to
> > that conclusion.
> 
> Well, my Zope process grows by 10 megs in a few hours, by just using XML
> Document and the management interface. It's of course possible some of
> my helper external methods leak memory. I'll work on a test case either
> today or next week.

I've done some more testing. Rendering from XML doesn't seem to be the
problem, generally; though I get some inconclusive results (especially
when acquisition seems to be involved, I'll try to figure out more
details on that). Sometimes it adds a few k, but usually the process
doesn't seem to leak a lot of memory. There seems to be a difference
from what happens with my python test script that calls urls (little
leaking of memory) and when I call it through the browser (this is
multiframe so some other frames are called as a side effect -- some
kilobytes appear to get leaked in some requests). I don't really
understand this. 

However, the big leaks is when I do a transaction that changes the DOM
(I do a removeChild, appendChild and a createTextNode in an external
method). Calling this same external method multiple times in a single
request does not seem to increase memory leaking. The memory leak here
is significant though; in the order of a 100k per request, often. I can
easily grow my procses by 10 megs this way, by repeated requests.

I realize that this is still unclear, and I'll try to come up with
something small that reproduces the leaks, if this information doesn't
help.

Incidentally, I think my testing has revealed a bug in the
ExternalMethod product. Sometimes, but not consistently, I get an error
at line 248 in ExternalMethod.py. I think this happens more often when
there's multiple threads trying to get at the same document. I posted an
example traceback to the collector; after more occurances I can add that
it's always this line 248 that raises an exception.

Regards,

Martijn