Re: [xml] quite huge memory consumption
- From: piotreks optonline net
- To: Grzegorz Ja?kiewicz <gryzman gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] quite huge memory consumption
- Date: Mon, 27 Jul 2009 14:07:50 +0000 (GMT)
> 2009/7/27 Daniel Veillard :
> No that's where node were allocated i.e. when parsing the tree
> if then
> you remove some of the tree pointers then valgrind will report where
> this was allocated not where the bug occured.
Yes, valgrind will point you to the spot where the memory was allocated.
> 2009/7/27
Grzegorz Ja?kiewicz:
> sDoc = xmlParseFile(filename);
...
> for(int j=0; j < sc->nodesetval->nodeNr; j++)
> {
> if(NULL != sc->nodesetval->nodeTab)
> {
> if(NULL!=(sNode = sc->nodesetval->nodeTab[j]))
> {
> xmlDocSetRootElement(sDoc, sNode);
I'm not sure what you're trying to do here, but I would assume you want to shorten the document for future xpath evaluation.
I personally would not do it this way because sDoc is the only pointer you have to memory allocated at xmlParseFile(). Once you 'shorten' the document, you effectively loose track of all memory that's not part of sNode's subtree. Maybe you could try getting the document fragment starting at sNode and make that the root of a _new_ document.
Piotrek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]