[XML-SIG] Re: [4suite] ReleaseNode interface in 4XSLT
Fred L. Drake, Jr.
Tue, 15 May 2001 11:40:26 -0400 (EDT)
Mike Olson writes:
> It depends on the interface into the XSLT/XPath engine. They way
> 4XSLT/4XPath is set up, if you pass us a DOM node to process, we won't
> touch it. It is your DOM node, you job to release it. However, if you
> call appendStylesheetUri (as an example) we create a DOM node, and we
> will release it when processing is done. Currently, you can call
> "setDocumentReader" on the 4XSLT processor to use anything that conforms
> to the Reader interface when fromUri, fromString, fromStream are
> called. We then call the coresponding releaseNode on the documetn
> reader to free the DOM tree when we are done with it.
This sounds pretty reasonable to me.
> So, I guess I still see plenty of cases where "unlink" makes sense.
> When would you want to use the DECREF equiv.?
If you're using something that isn't GC friendly, such as minidom,
you need explicit incref/decref machinery to be able to discard the
document when it is no longer being used. This is less of an issue
with the cycle detector introduced in "modern" Python releases, but is
still a real problem with Python 1.5.2. And there are still a fair
number of users of the older version, for a variety of reasons.
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations