[xml] [xmlParser] xmlFreeDoc do not free memory allocated with xmlParseFile
- From: Emmanuel Saracco <esaracco users labs libre-entreprise org>
- To: xml gnome org
- Subject: [xml] [xmlParser] xmlFreeDoc do not free memory allocated with xmlParseFile
- Date: Wed, 03 Nov 2004 12:47:55 +0100
Hi,
Again... :-)
Using "xmlFreeDoc ()" on a "xmlDocPtr" initialized with "xmlParseFile
()" do not free anything.
Here is the output of a basic program that just initialize "doc" and
free it just after:
----------
grinch badiou:~$ cat test.c
#include <libxml/parser.h>
void main (void)
{
xmlDocPtr doc = NULL;
printf (">> Before parsing:\n----------\n");
system ("free -m -o");
printf ("----------\n");
doc = xmlParseFile ("/home/grinch/test.xml");
printf (">> After parsing:\n----------\n");
system ("free -m -o");
printf ("----------\n");
xmlFreeDoc (doc), doc = NULL;
printf (">> After freeing:\n----------\n");
system ("free -m -o");
printf ("----------\n");
}
grinch badiou:~$ ./test
Before parsing:
----------
total used free shared buffers
cached
Mem: 502 281 221 0 8
94
Swap: 980 235 745
----------
After parsing:
----------
total used free shared buffers
cached
Mem: 502 500 1 0 8
94
Swap: 980 235 745
----------
After freeing:
----------
total used free shared buffers
cached
Mem: 502 500 1 0 8
94
Swap: 980 235 745
----------
grinch badiou:~$
----------
-> 281M used before, 500M after parsing doc, and 500M after freeing doc.
Do I need to do anything else to free it?
Thanks,
Bye
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]