Re: [xml] =?iso-8859-1?q?=BFleak_using_libxml2_for_sax-parsing_html_i?= =?iso-8859-1?q?n_python=3F?=



I´ve been looking at the python bindings and I think I have seen something....
We´ll I have to understand how it exactly works... as I don´t know what is every file for.

The thing is that I guess that the function that needs to be called to free the context is htmlFreeParserCtxt.

But in the context returned by htmlCreatePushParser (class parserCtxt) in the __del__ method the function that gets called is xmlFreeParserCtxt.

So, it is not true that the developer has to free the resources (no python style), because when you assign None to the context a 'freeresources' function is called.
Furthemore,  it looks that the wrong funcion is called.

Regards, Cesar

On 1/5/07, Cesar Ortiz <cesar ortiz gmail com > wrote:
I put in my first email the example that 'leaks'. I am afraid I am assuming something, but I have not seen any good example.
The source file I took in order to do my implementation was the test 'pushSAXhtml.py ' that comes with the distribution.

The only thing that is done in that example about the release of resources  is: 'ctxt = None'.
I have tried to use the following functions:

ctxt.htmlFreeParserCtxt ()
ctxt.clearParserCtxt()

And I get segment violations.



On 1/5/07, John Dennis <jdennis redhat com> wrote:
On Fri, 2007-01-05 at 17:21 +0100, Cesar Ortiz wrote:
> Hi,
>
> Maybe the top is fooling me, but after 10 minutes of execution (the
> example I attached with an infinite loop) it took half of the machine
> memory (2 Gbs of a 4Gbs Linux Box), and later the process crashed due
> to a 'Memory Error'.
>
> I am pretty sure libxml2 does not leak, but may be there is something
> wrong with the python bindings, or may be I am forgetting something.

Are you calling freeDoc, freeNode, xpathFreeContext, etc. or are you
blindly assuming the python bindings are doing this for you?
--
John Dennis < jdennis redhat com >





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]