[xml] memory allocation problem




Hello,

 I have tried to used libxml2 to parse simple XML document and I have problem
with memory leaking. My code is:

xmlInitParser();

for(;;) {
  doc=xmlParseMemory(buf,len);
  root_element = xmlDocGetRootElement(doc);
  check_element(root_element);
  xmlFreeDoc(doc);

  sleep(1);
}
xmlCleanupParser();

While running in cycle, memory usage is growing. According valgrid, all memory
is correctly freed in xmlCleanupParser(), but because I'm in indefinite loop,
memory is not released between two cycles ...

And the same code is used in several threads - therefore I'm not able to call
xmlInitParser()+xmlCleanupParser() in each cycle.

Any suggestions?
-- 
                  Mirek Ruda




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