Re: [xml] xmlParserCtxt Leak?

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();


        xmlCleanupParser() missing at the end of the program

      return 0;

  What about reading the documentation ?


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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