xml parser memory leak???
Victor Muslin
victor at prodigy.net
Tue Jun 12 15:21:06 EDT 2001
Using Python 2.1 on Windows 2000 platform.
The following program produces a HUGE memory leak, but only when the
parsed request is malformed. Unfortunately, when the request is
malformed it is not possible to unlink dom for the deallocation (i.e.
"dom.unlink()" inside except clause), because dom is undefined.
Any suggestions?
TIA
import xml.dom.minidom
good = '<request>yada yada yada</request>'
bad = '<foo>yada yada yada</bar>'
for i in range(2000):
try:
dom = xml.dom.minidom.parseString(bad)
dom.unlink()
except xml.sax._exceptions.SAXParseException, e:
pass
More information about the Python-list
mailing list