[XML-SIG] Small memory leak

Mike Olson Mike.Olson@fourthought.com
Mon, 18 Dec 2000 01:47:04 -0700


In the DTDParser.  There is a cirular reference, cyclops output follows:

0x84e1850 rc:1 instance xml.parsers.xmlproc.dtdparser.DTDParser
    repr: <xml.parsers.xmlproc.dtdparser.DTDParser instance at 84e1850>
    this.ent ->
0x84e1968 rc:1 instance xml.parsers.xmlproc.xmlapp.EntityHandler
    repr: <xml.parsers.xmlproc.xmlapp.EntityHandler instance at 84e1968>
    this.parser ->
0x84e18d0 rc:1 instance xml.parsers.xmlproc.xmlapp.ErrorHandler
    repr: <xml.parsers.xmlproc.xmlapp.ErrorHandler instance at 84e18d0>
    this.locator ->
0x84e1850 rc:1 instance xml.parsers.xmlproc.dtdparser.DTDParser
    repr: <xml.parsers.xmlproc.dtdparser.DTDParser instance at 84e1850>


I got around it by changing the deref function on DTDParser to also set
self.ent to None.

    def deref(self):
        "Removes circular references."
        self.ent = self.dtd_consumer = self.dtd = self.app = self.err =
None

Mike

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python