Re: [xml] Memory not going away..
- From: "David W. Bauer Jr." <bauerd ashley cs rpi edu>
- To: Daniel Veillard <veillard redhat com>
- Cc: xml gnome org
- Subject: Re: [xml] Memory not going away..
- Date: Tue, 8 Mar 2005 12:04:51 -0500 (EST)
I re-compiled with --mem-debug and this is the contents of .memdump:
11:47:59 AM
MEMORY ALLOCATED : 0, MAX was 222911016
BLOCK NUMBER SIZE TYPE
That's it. Also, I wrote a quick test to verify what I thought to be
true.. that is that Linux reports the memory correctly as you alloc/free.
I tested both calloc and malloc and top, ps and /proc were all correct.
I think that have some not configured properly since memdump is empty.
Also, does it sounds correct that the parser requires 10 times the XML
file size in memory? That is just something I noticed.
Thanks for your help and quick response!
David Bauer
Ph.D Candidate, Rensselaer Polytechnic Institute
Computer Science Department
Office: Amos Eaton 205
Phone : (518) 276 2657
URI : http://www.cs.rpi.edu/~bauerd
On Tue, 8 Mar 2005, Daniel Veillard wrote:
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]