[Python-bugs-list] [ python-Bugs-462710 ] Python 2.2a3/XML leaks memory
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 23 Sep 2001 03:26:33 -0700
Bugs item #462710, was opened at 2001-09-18 16:56
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=462710&group_id=5470
Category: XML
Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jeffrey Chang (jchang)
Assigned to: Martin v. Löwis (loewis)
Summary: Python 2.2a3/XML leaks memory
Initial Comment:
I'm running Python 2.2a3 on solaris 2.6 with expat 1.2. The following bit
of code leaks a ton of memory. Within 5 seconds, it's used up 50Mb of
memory.
--------
from xml import sax
from xml.sax import handler
print sax.make_parser().__doc__
while 1:
parser = sax.make_parser()
parser.setContentHandler(handler.ContentHandler())
parser.feed("<TEST>hello!</TEST>")
--------
Python 2.1 in the same environment seems to leak little or no memory.
I tried compiling Python 2.2a3 with an older version of pyexpat, 1.45 (the one that comes with Python 2.1) and using Python 2.1's xml package, but it still leaks.
The problem may be somewhere outside the XML package. I looked through the release notes for 2.2, but could find nothing obvious.
This seems to be different from bug #416288 "infrequent memory leak in pyexpat", in that it leaks memory quite severely and not on an exceptional error condition.
Thanks,
Jeff
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2001-09-23 03:26
Message:
Logged In: YES
user_id=21627
This is fixed in pyexpat.c 2.51. The problem was that the
garbage collection APIs in Python have changed, so that
expat parsers were no longer collected.
Please note that it is better to invoke the parser's close
method, to avoid relying on garbage collection.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=462710&group_id=5470