Hey,
At the moment, the nodes themselves are "reused". When you call release on a node, we keep a pointer to it and just new another one over the top of it. However, any memory newed by by the nodes will remain (For example, in DOMElement, an attribute list is newed) until the document is released. As Jesse points out, if you implemented your own memory manager and also deleted the list (and whatever else) in the release call then this would work.
Gareth
Jesse Pelton wrote:
You could presumably do this by implementing your own MemoryManager and specifying it when you call createDocument(), createDOMBuilder(), or whatever you use to create the document. I believe that your implementation can manage memory in whatever manner it sees fit, including releasing memory back to the OS every time something is deleted. Not that this would be a great idea; it's generally quite expensive, which is part of the reason heap managers exist. You're more likely to want to implement some sort of block recycling scheme. The simplest way to do this is probably to just call the standard C library's malloc() and free() (assuming they're well implemented on your target platform(s)).
------------------------------------------------------------------------ *From:* Mouawad, Tony [mailto:[EMAIL PROTECTED] *Sent:* Wednesday, March 02, 2005 9:58 AM *To:* 'xerces-c-dev@xml.apache.org' *Subject:* Releasing DOMNodes not releasing all of memory
Hello,
We're currently faced with a challenge where when we create DOMNodes, use them and then release them, our application memory keeps growing with each DOMNode created and released. In order to free up the memory consumed with by several iterations of creating and releasing DOMNodes, we have to actually release the document associated with the nodes to regain that memory. This is sensible, except for the fact that we designed ourselves into a situation where we cannot release the associated DOMDocument until the application is terminated. This is partly because of how we are using a XML C++ code generator to bind generic C++ objects to XML data.
My current understanding with versions of Xerces C++ including the most current version is that creating and releasing DOMNodes in a DOMDocument consumes memory and will keep consuming memory until the document is released. Is this true?
Can someone recommend a way of releasing the consumed memory without
actually releasing the document?
If this question is not relevant to this particular mail group, can someone point me in the right direction?
Thank you,
Tony
-- Gareth Reakes, Managing Director Parthenon Computing +44-1865-811184 http://www.parthcomp.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]