Re: [xml] Memory not going away..
- From: Daniel Veillard <veillard redhat com>
- To: "David W. Bauer Jr." <bauerd cs rpi edu>
- Cc: xml gnome org
- Subject: Re: [xml] Memory not going away..
- Date: Tue, 8 Mar 2005 05:25:03 -0500
On Tue, Mar 08, 2005 at 03:35:30AM -0500, David W. Bauer Jr. wrote:
I have a simple test script I am using to my code:
int
main(int argc, char **argv, char **env)
{
xmlDocPtr document_network = NULL;
xmlXPathContextPtr ctxt = NULL;
xmlXPathInit();
you should initialize the library instead, not just XPath
xmlSetDocCompressMode(document_network, 9);
document_network = xmlParseFile("network.xml");
ctxt = xmlXPathNewContext(document_network);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(document_network);
xmlCleanupParser();
xmlMemoryDump();
what do you have in .memdump ?
return 0;
}
If I run this in gdb and break on the return statement, then view the
memory usage in top, ps or /proc, I notice that the memory usage does not
go away.
I am using a 300GB file, and the parser is requiring about 3GB if
RAM. Sorry if this is a simple oversight on my part, but I could not find
the solution in the code examples or online archive.
depends how the memory allocator works, ps or to report the amount used
by the process not by the library. Try to malloc 3GB of ram in small chunks,
fill them with data, then free() them, without even using libxml2. My bet
is that you will see the same result.
What the library really allocates or free should be listed in your
.memdump assuming you compiled the library with memory debug
http://xmlsoft.org/xmlmem.html#Debugging
Daniel
--
Daniel Veillard | Red Hat Desktop team http://redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]