Re: [libxml++] memory leak in SaxParser



Le Mercredi 23 Avril 2003 19:03, Christophe de VIENNE a écrit :
> In fact the good solution is probably to use xmlSAXUserParseFile and
> xmlSAXUserParseMemory to create the contexts, and not
> xmlCreateMemoryParserCtxt and xmlCreateFileParserCtxt which are to be used
> only for DOM.

It seems I've spoken a bit fast sorry ;-) We can't do that. The functions I 
spoke about don't return a context.

So we have to make sure either the sax handler can be freed by libxml, either 
handle it ourselves.
The proposed solution was not handling the same problem happening with 
xmlCreatePushParserCtxt, that we use for parse_chunk and parse_stream, which 
makes a copy of the sax handle we give to it, and this copy is never 
released.
So I removed the reset of sax handler in release_underlying. In parse, I just 
save the defaut sax parser and restore after parsing, as it is done in 
xmlCreateMemoryParserCtxt for example.

I think this correct the problem(s).

Cheers,

Christophe





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