Re: [xml] Memory not going away.. SOLUTION
- From: "David W. Bauer Jr." <bauerd cs rpi edu>
- To: Daniel Veillard <veillard redhat com>
- Cc: xml gnome org
- Subject: Re: [xml] Memory not going away.. SOLUTION
- Date: Tue, 8 Mar 2005 17:43:22 -0500 (EST)
Ok, I have provided the simplest of examples, and cannot account for why
this is so either, but that doesn't change the fact that it is so.
Probably, I am just got lucky in some way.. but this should be simple
enough for someone to look at and see what is wrong immediately.
After spending the entire day digging through API dox, source code, and
examples, I am no closer to solving the problem.. because, when I applied
this solution to my working code, it did not work.
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 01:01:26PM -0500, David W. Bauer Jr. wrote:
Recall I had:
xmlXPathInit();
document_network = xmlParseFile(filename);
ctxt = xmlXPathNewContext(document_network);
xmlXPathFreeContext(ctxt);
xmlFreeDoc(document_network);
xmlCleanupParser();
xmlMemoryDump();
The solution:
xmlXPathInit();
document_network = xmlParseFile(filename);
ctxt = xmlXPathNewContext(document_network);
xmlXPathFreeContext(ctxt);
xmlCleanupParser();
xmlFreeDoc(document_network);
xmlMemoryDump();
Notice that I need to cleanup the parser prior to freeing the document.
Makes absolutely no sense. xmlCleanupParser() is a library wide
memory deallocation, you should not call it while you had document allocated
since they could now point to freed area (example predefined entities).
I think your methodology of test is wrong, and the programming way of
trying anything until it seems to work to not be better. Read the doc
dor xmlCleanupParser() it is very clear you should not do this.
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]