[xml] memory leak?



Hi,

I have noticed that the size of a program repeatedly loading and freeing
XML documents constantly increases. I attach a test program to be run
with one argument, a XML document. The program then loops, so you can
trace its size with `top'.
Is anyone else experiencing the same behaviour? Or am I missing some
structure to be freed?
(I use 2.3.8).

Regards,

        luca

#include <libxml/tree.h>
#include <libxml/SAX.h>
#include <libxml/parserInternals.h>

main(int argc, char* argv[])
{
        while(1) {
          xmlSAXHandler sax;
          xmlParserCtxtPtr ctxt;
          xmlDocPtr doc;

          sax = xmlDefaultSAXHandler;
                                
          ctxt = xmlCreateFileParserCtxt(argv[1]);
          ctxt->sax = &sax;
                                      
          xmlParseDocument(ctxt);
                        
          doc = ctxt->myDoc;
          ctxt->sax = NULL;
          xmlFreeParserCtxt(ctxt);

          xmlFreeDoc(doc);
        }
}






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