[4suite] Releasing a document

Alexandre Fayolle alf at logilab.com
Thu Sep 7 08:42:46 MDT 2000


On Wed, 6 Sep 2000, Mike Olson wrote:

> I guess I don't see where the circular references come into play.  If a
> document creates a Node, and the node is never added as a child to the
> document, then there are no circles.  the Node will have a pointer to
> the its owner doc, but no cycle because the node does not have a parent
> or children.  Now, if there is more then a single node in the
> disconnected branch (ie it has children) then there is a cycle.  Is this
> the case? 

It is indeed.

>  Are you calling replaceNode on a branch?
> 
> > 
> > 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...).
> 
> Do you have a list of places where we do this?  I just did a very simple
> search and was unable to come up with any cases (though there very well
> could be).  We should be calling createXXX in all spots.  I know there
> was one in Sax2, but that is fixed.

This is mainly the one I was refering to. If it's fixed, it's fine. There
is another case in cloneNode where createXXX is not called, but this one
is not a problem since it uses self.__class__ to get the constructor.


> I don't think this is necessary.  How are you using 4DOM where this is
> needed?  One other note python 2.0 is in beta with _much_ better memory
> mangement so this could all be a mute point.

That's very good news. I have not had a chance to look at Python 2.0 yet,
but this is very good news indeed.

> One note, we are working out all of the details, but within a week we
> should have public CVS access...

Excellent...

-- 
Alexandre Fayolle
Logilab





More information about the 4suite mailing list