Re: [xml] memory leak while parsing from memory buffer
- From: Daniel Veillard <veillard redhat com>
- To: Petr Pajas <pajas ufal ms mff cuni cz>
- Cc: libxml2 <xml gnome org>
- Subject: Re: [xml] memory leak while parsing from memory buffer
- Date: Wed, 7 Apr 2004 14:02:32 -0400
On Wed, Apr 07, 2004 at 07:48:49PM +0200, Petr Pajas wrote:
But, although ctxt->input->filename _does_ get freed with
xmlFreeParserCtxt, the above code leaks. If the line with xmlStrdup is
removed, the leak disappears. I suspect, that somewhere, during
xmlParseDocument some copies of filename are made but never freed or
something similar. Otherwise I don't know why this line would make any
difference. BTW, it's the same if I set
ctxt->input->filename = "";
and put
ctxt->input->filename = NULL;
just before xmlFreeParserCtxt(ctxt).
Any hints?
that would mean that the error handling code leaks.
For some reasons it doesn't seems to occur in the common path
of libxml2, even when trying to reproduce exactly the same prob
with a libxml2 compiled with memory debug (xmlsoft.org/memory.html):
paphio:~/XML -> xmllint --memory --valid --noout tst.xml
tst.xml:4: element bar: validity error : No declaration for element bar
<bar/>
^
paphio:~/XML -> cat .memdump
07:59:25 PM
MEMORY ALLOCATED : 0, MAX was 19218
BLOCK NUMBER SIZE TYPE
paphio:~/XML ->
--memory --valid options should reproduce the parser options you
detailed, so I'm a bit puzzled.
valgrind or using other memory detection tools might help track this
down.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]