help with xml.dom.minidom memory leak

Martin von Loewis loewis at informatik.hu-berlin.de
Thu May 24 17:32:24 CEST 2001


victor at prodigy.net (Victor Muslin) writes:

> Below is a short program that leaks memory. Any ideas how to plug the
> leak? What am I doing wrong?

What python version? With your exact code, I get a traceback

  File "/usr/local/lib/python1.5/site-packages/xml/dom/minidom.py", line 441, in unlink
    for attr in self._attrs.values():

since, after unlinking the document, unlinking the DOM fails.

With Python 2.1 and PyXML 0.6.5, on Solaris 8, I cannot reproduce the
memory leak, nor can I reproduce it with plain Python 2.1 (i.e. no
PyXML).

In Python 2.0, there was a bug where pyexpat objects where not
properly deallocated after parsing, and would not be found by the
garbage collector either.

I recommend either installing PyXML, or updating to Python 2.1.

Regards,
Martin



More information about the Python-list mailing list