[4suite] Replace Child problems (fwd)
Nicolas Chauvat
nico at logilab.com
Fri Sep 8 11:54:47 MDT 2000
On Thu, 7 Sep 2000, Mike Olson wrote:
> Alexandre,
He's coding and writing doc right now, so I'll answer that one :-)
> I seem to have lost your last message after I read it, but I wanted to
> continue the thread.
>
> You say that you replace branches of a document tree with new branches,
> and the replaced branches are not being released (hence the
> ReleaseDocument function). I guess I'm curious as to why you can't
> release the node as soon as they are replaced? You have a pointer to
> the branch that you want to replace at the time of the replace. You
> should be able to pass it to ReleaseNode after the replace is done and
> that branch should get released
Our case is somewhat different from the above.
What we have is an engine that manipulates XML documents and uses
"plug-ins" to modify them. The engine is not supposed to stop running. We
will not have full control over the plug-ins. Others will write them.
When we finish a sequence of transformations (made by plug-ins), we want
to get rid of the intermediary documents. We do not know for sure that the
plug-ins cleanly released all unneeded nodes. If there are cycles, we leak
memory.
What we did was to make the document maintain a list of all its nodes
(even "free" nodes that were created but not attached to a parent), in
order to make sure that when we release a document, all its nodes (even
the ones that remain because of a badly behaved plug-in) are
released.
That wouldn't happen if it wasn't for python's garbage collector that
works with ref counts and let autonomous node communities live their lives
alone...
--
Nicolas Chauvat
(o- Hi, I'm a deadly e-mail virus, please copy me into your .signature
/\ file to help me spread. :: Bonjour, je suis un dangereux virus. SVP
Y_/_ copiez-moi dans votre fichier .signature pour m'aider me propager.
More information about the 4suite
mailing list