[4suite] Releasing a document

Uche Ogbuji uche.ogbuji at fourthought.com
Tue Sep 5 10:51:47 MDT 2000


Alexandre Fayolle wrote:

> The product I'm currently working on (and that'll be released in 2-3
> weeks) requires us to be able to release a document completely. By this I
> mean releasing every node, even those that do not have a parent, but
> are still attached to the document, like any well behaved Node.

I think we have this working in our CVS version.  See below about
discussing how we can be sure of this to support your needs.

> To achieve this, we made a few changes to 4Dom, mainly adding a
> dictionnary of nodes in Document and changing the constructor of Node so
> that it adds the node to the dictionnary (we used a dictionnary because
> lookup is much faster than in a list, but we basically use it as a
> list). Then we added a ReleaseDocument function in xml.dom.ext that
> Releases each Node in the dictionnary. It works fine... hmm, good enough
> for now :o)

This should not be necessary.  We think we achieved memory cleanliness
by simply hunting down all the places nodes were indirectly pointing
back to the doc (besides through parentNode) and eliminated them.  We've
verified this in our labs using Cyclops.  The trick will be to see
whether it works under your patterns.

> However, we are now facing a problem because our version of 4Dom is
> getting different from 4Thought's. We considered changing the way we do
> things by subclassing Node and Document to match our needs but in many
> parts of 4Dom, there are direct calls to the constructor of a class
> instead of a call to node.ownerDocument.createXXX(), and this is not
> something we can deal with easily (it would mean rewriting these parts in
> our subclasses...).
> 
> Hence the following questions :
> * Would 4Thought integrate a ReleaseDocument patch in the official
> release?

If it's necessary.  However, I propose this instead.  We claim our CVS
is clean.  And we have on our project calendar to effect a 4Suite
release late this week or early next.  I don't remember what platform
you're running.  Please let me know.  We've already promised a Windows
pre-release to Lars Garshol, which we could make abailable for all to
beta-test.  We can also put up a Linux pre-release as well if there is
demand.

> * Would 4Thought use a little bit of help to do some cleanup in order to
> respect the DOM interface internally with regard to Node creation ?

If our pre-release doesn't address the issue for you, we can do more
specific debugging.  I still don't think we'll need to go as far as you
did to fix it, but we'll see.

> * Are those things fixed already and about to be released ?

Hopefully "yes".


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji at fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python



More information about the 4suite mailing list