Re: [xml] Memory not going away..

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:

main(int argc, char **argv, char **env)
        xmlDocPtr       document_network = NULL;
        xmlXPathContextPtr ctxt = NULL;


   you should initialize the library instead, not just XPath

        xmlSetDocCompressMode(document_network, 9);
        document_network = xmlParseFile("network.xml");
        ctxt = xmlXPathNewContext(document_network);


   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


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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