Re: [libxml++] memory leak in SaxParser



at it is done in xmlSAXUserParseMemory...

I think this is the best solution.
Thank you for your immediate reaction.
Good luck


Thierry


----- Original Message -----
From: "Christophe de Vienne" <cdevienne alphacent com>
To: <libxmlplusplus-general lists sourceforge net>
Sent: Thursday, April 24, 2003 1:13 AM
Subject: 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



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Libxmlplusplus-general mailing list
Libxmlplusplus-general lists sourceforge net
https://lists.sourceforge.net/lists/listinfo/libxmlplusplus-general






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