Re: memory leak in reportlab xmllib.FastXMLParser

Mirko Dziadzka <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
Using the Slow Parser by disabling the sgmlop solved my immediate problem. Our paragraphs are short ;-)

After a second look on FastXMLParser, there seems to be 2 references to the sgmlop parser.

        self.parser = sgmlop.XMLParser()
        self.feed = self.parser.feed

and close() is only setting self.parser to None, self.feed still has a reference to sgmlop.

changing FastXMLParser.close() by adding a

self.feed = None

removes the memory leak in the simple example.

OTOH ... I'm not sure if paraparser is calling close() on the xmllib in all cases.


On 17.12.2013, at 18:13, Robin Becker <[email protected]> wrote:

> I suspect we've had this problem for a long time in the sgmlop c extension module. Originally the paraparser.py module used to create just one parser for use by all the paragraph instances, but I think Andy recent changed that to create one for each instance in a vain attempt to stop threading issues.
> 
> I'll take a look at the sgmlop.c code to see if I can spot this; that code is very old and not our originally. It certainly doesn't cooperate with GC at all.
> 
> 
> On 17/12/2013 16:14, Mirko Dziadzka wrote:
>> Hi
>> 
>> I’m not sure if this is the right list for a bug report, any pointers to another address are welcome.
>> 
>> Problem description
>> ===============
>> 
>> The following program creates a memory leak.
>> 
>> As a result, using reportlab.platypus.paraparser.ParaParser creates a memory leak too.
>> As a result, wordaxe has a memory leak (my original problem)
>> 
> ........
> 
> -- 
> Robin Becker
> _______________________________________________
> reportlab-users mailing list
> [email protected]
> http://two.pairlist.net/mailman/listinfo/reportlab-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.