Hello Alberto, and thanks a lot for the enlightening answer. However, I need few more clarifications.
1. Debugging through the DOMNode->remove()->release() process, I have seen these strings being pushed into a "recycled" container. Why does the code bother to do that, if the "pages" as you call them are never actually cleaned? 2. I have noticed, too, that on some occasions xerces DOES reuse released nodes (I got the same pointers again and again when creating elements, attributes etc.) What is the rule here? I suspect that repeated doc->importNode() is the call that bloats my DOMDocument. But I have no proof... 3. If DOMDocument does not keep track of the cleaned "pages" (Are they the "buckets" in the code?) can I add a cleanup function to DOMDocumentImpl.cpp/hpp to EXPLICITELY scan and release such "pages" ? Can you hint on the implications? I don't need to do it very often so such function can be (for my purpose) inefficient, but I absolutely need to do this at times. Thanks a lot - Motti Shneor -----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 12, 2006 10:15 AM To: [email protected] Subject: Re: DOMDocument memory bloating problem 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. >[EMAIL PROTECTED] >http://www.orbograph.com > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
