[XML-SIG] Re: [4suite] ReleaseNode interface in 4XSLT
Fred L. Drake, Jr.
Mon, 14 May 2001 16:37:09 -0400 (EDT)
Martin v. Loewis writes:
> I can't understand the value of the first option. If you don't need an
> Element or a document anymore which somebody else might be holding
> onto, you can just drop it, right?
You can't do that in minidom without requiring cyclic GC, and that's
not available for all projects thanks to users of legacy Python
versions. I'm really learning to dislike Python 1.5.2. ;-(
> Not necessarily. Currently, 4XSLT uses ReleaseNode e.g. to release a
> style sheet, in a data flow:
> - read the style sheet using the StylesheetReader from an XML document
> (i.e. a byte stream)
> - process the style sheet
> - release it
> Another application is with result tree fragments: when instantiating
> an element, nodes get cloned over and over, and temporary results need
> to be released.
OK, this makes sense. As long as it only releases nodes that it
creates and does not use as part of the result, that's fine. As long
as I can create a stylesheet and store it as a persistent object,
create and store a bunch of documents, and then process them over &
over without damaging them, and make the results persistent and usable
in the same fashion, I'm happy. ;-)
> There may be also cases where 4XSLT releases elements it did not
> create; I'd consider that a bug.
> I don't think we should introduce explicit reference counters for
> documents or some such; we should strive for less memory management,
> not more.
Agreed as well. If we can rely on GC, then I'm all for it. I just
wanted to be sure that we were clear on the semantics of
.releaseNode(), since it has a large potential for disaster.
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations