On Fri, Jun 13, 2008 at 05:00:02PM -0700, mt2 wrote:
> Hello all,
> I've just started using xmlParserCtxtInit() and friends to create a
> reusable parser to parse lots of documents in a row (this is the right
> thing to do, keep the parser context alive and parse new documents)
> though I've detected what I think is a memory leak. I wrote a small

  Ho did you detected that ? There is many way people usually get fooled
just because they don't understand how memory allocators work.

> program to test the way I am working with libxml. If I am reading
> valgrind's output correctly (there's a real change I'm not) this small
> program is missing one free(); I've attached it's output, too.

  you're missing one call at the end of the program

> Finally, I might be using the parser API incorrectly (and there's a
> good chance for that), so if anyone could point me in the right
> direction there, too, I'd be much obliged. Also,

  No idea as you didn't provide an exemple reproducing a leak here.

> xmlMemoryDump() doesn't seem to output anything? On Ubuntu, I'm using

  probably because it wasn't compiled with memory debug, which is normal 
as it's not a default.

> 2.6.31, and on Windows I'm using 2.6.32; I've reproduced this on both
> platforms-- I'm at a loss here...
> 
> #include <libxml/parser.h>
> 
> int main()
> {
>       xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
>       xmlInitParserCtxt(ctxt);
> 
>       xmlFreeParserCtxt(ctxt);
>       
>         xmlMemoryDump();

        xmlCleanupParser() missing at the end of the program

>       return 0;
> }
> 

  What about reading the documentation ?

    http://xmlsoft.org/xmlmem.html

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to