[xml] xmlParseFile alocates memory and xmlFreeDoc does not free all the memory
- From: Ioan Paul Pirau <ioanpaul pirau tanner de>
- To: xml gnome org
- Subject: [xml] xmlParseFile alocates memory and xmlFreeDoc does not free all the memory
- Date: Thu, 02 Dec 2004 21:16:10 +0100
Hello,
I have this sequence of code :
xmlDocPtr doc;
xmlNodePtr node, pNode;
xmlChar* key;
//check if the file is valid against it's DTD
xmlDoValidityCheckingDefaultValue = 1;
xmlParserCtxtPtr pctxt;
pctxt = xmlCreateFileParserCtxt(strFileName.c_str());
xmlParseDocument(pctxt);
if (!pctxt->valid)
{
p_Result = NoBook;
return;
}
doc = xmlParseFile((char*)strFileName.c_str());
xmlFreeDoc(doc);//clear memory
xmlCleanupParser();
xmlMemoryDump();
... and the thing is that xmlFreeDoc does not delete all the memory
allocated by the calls :
xmlParseDocument(pctxt);
and
xmlParseFile((char*)strFileName.c_str());
In my case I use a 2 Mb XML file and the memory leak is quite big ...
SO :
xmlParseDocument(pctxt); //allocates 36
kb of memory
xmlParseFile((char*)strFileName.c_str()); //allocates 60 kb of
memory
xmlFreeDoc(doc); //clears 20
kb of memory
xmlCleanupParser(); //doesn't
clear any memory ( or <1kb)
xmlMemoryDump(); //doesn't clear
any memory ( or <1kb)
Any ideeas where this might come from?
I've read the rest of the postings on the memory leaks created by this
functions .. but none were helpfull.
I mention that use the latest windows version of libxml2.
regards,
John Paul Pirau
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]