There is a fundamental problem with this memory model. Imaging a DOM emulation implementation, that is capable of reading terra byte XML files. In the current model, if somebody is just walking the tree using getFirstChild(), getNextSibling(), ... you can never dispose those DOMNodes since you can't know when those nodes went out of the clients scope. This is a serious flaw, and my own DOM implementation that has a reference counting is now broken [that means reference counting can't be used anymore and object get never release until the document is closed/released].
I would propose a virtual dispose() function [I would have preferred release(), but that is already used] that does nothing in the Xerces implementation. But another implementation can dispose the underlying node, if its reference count falls to zero. This has as implication that all the users 'should' call dispose() as soon as a node goes out of scope, if they don't it would be not fatal, they would just not allow early disposal of memeory. We could then fix/change all the internal tree walking code to issue dispose calls [I would volunteer to send a change]. I will have to implement that anyway, but if you want something like that in the official implementation, let me know, and we can share ideas how to implement it. - URS C. MUFF SYSTEMS ARCHITECT - RESEARCH LAB > -----Original Message----- > From: Gareth Reakes [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 20, 2002 1:56 AM > To: '[EMAIL PROTECTED]' > Subject: Re: Clarification needed on DOM memory management > > Hi Dan, > > > I have two questions: > > 1. Does "implementation" mean *my* application code or does it mean the > > Xerces developed DOM implementation? > > If you do not do anything then the document will delete all the allocated > memory when it is deleted (As long as you have not adopted the document). > > > > 2. Would the list of methods that return an object owned by > implementation > > include DOMNode* getFirstChild()? Asked another way, is my application > > responsible for deleting the DOMNode returned by getFirstChild()? > > > No. You can call release on nodes you know are orphaned. This will signal > the document that it can reuse the memory from that node. > > > For a more full explanation have a hunt in the archives. I described the > model in more depth a month or two ago. > > > Gareth > > -- > Gareth Reakes, Head of Product Development +44-1865-203192 > DecisionSoft Limited http://www.decisionsoft.com > XML Development and Services > > > > > --------------------------------------------------------------------- > 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]