You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Motti Shneor <Mo...@orbotech.com> on 2006/12/12 08:36:50 UTC

DOMDocument memory bloating problem

Hello everyone. Happy to join the list.

I use a system that reuses the same xerces::DomDocument for long period,
adding and releasing DomNodes (elements, attributes etc.) continuously.

Although I DomNode->remove()->release() every unneeded node, the memory
taken up by DomDocument seems to ever increase, to the point the program
becomes unusable.

In the docs, it is recommended that I release unused nodes, but it only
is assured that they are actually released when the document is
released. This is not good enough in my situation.

I see that xerces memory manager's "deallocate()" is never called on my
nodes until I explicitly DomDocument *myDoc->release();


I am seeking a way to instruct a DomDocument to actually clear and free
its RELEASED nodes. Something like a partial DomDocoment->release() that
will only clean up its heap from released stuff.

Is it possible? Is there a simple way to do this? What are the prices?

Any ideas?


Motti Shneor
Senior Software Engineer
Orbograph Ltd.
motti.shneor@orbograph.com
http://www.orbograph.com  

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: DOMDocument memory bloating problem

Posted by Alberto Massari <am...@datadirect.com>.
Hi Motti,
unfortunately there is no such control on the memory allocated by 
DOMDocument: all of the nodes and strings used in the DOM tree come 
from a memory pool allocated by the DOMDocument, and they can be 
freed only by deleting the entire page (and DOMDocument doesn't keep 
statistics to check whether an entire page contains only released 
nodes). So the only way to release the memory is by releasing the 
entire DOMDocument.

Sorry if this is not the answer you would have liked,
Alberto

At 09.36 12/12/2006 +0200, Motti Shneor wrote:
>Hello everyone. Happy to join the list.
>
>I use a system that reuses the same xerces::DomDocument for long period,
>adding and releasing DomNodes (elements, attributes etc.) continuously.
>
>Although I DomNode->remove()->release() every unneeded node, the memory
>taken up by DomDocument seems to ever increase, to the point the program
>becomes unusable.
>
>In the docs, it is recommended that I release unused nodes, but it only
>is assured that they are actually released when the document is
>released. This is not good enough in my situation.
>
>I see that xerces memory manager's "deallocate()" is never called on my
>nodes until I explicitly DomDocument *myDoc->release();
>
>
>I am seeking a way to instruct a DomDocument to actually clear and free
>its RELEASED nodes. Something like a partial DomDocoment->release() that
>will only clean up its heap from released stuff.
>
>Is it possible? Is there a simple way to do this? What are the prices?
>
>Any ideas?
>
>
>Motti Shneor
>Senior Software Engineer
>Orbograph Ltd.
>motti.shneor@orbograph.com
>http://www.orbograph.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>For additional commands, e-mail: c-dev-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org