On Thursday, 06/13/2002 at 02:53 ZE2, Tobias Wahlstr�m <[EMAIL PROTECTED]> wrote:
> reson that my application ran out of memory was that when you return a
> org.w3c.dom.Node from an extension element a new DTM is allocated. The
> DTM will not be released, thus heavy use of such extension elements will
> cause a lot of DTM's to be created.
Hmmm. That does sound like a glitch. I agree that this sounds like a situation that should be managed as a Result Tree Fragment. The fact that it's going through DOM2DTM rather than SAX2DTM complicates that slightly, but it really ought to be managable.
> Why don't xalan do in a similar way? Why does it go through a DTM?
Because the value returned by an extension function may undergo further operations in that _expression_, or be assigned to a variable and operated on or used repeatedly later. The DTM is our internal representation for a document or document fragment.
Though this suggests that there may be an opportunity for optimization when we know the output of an extension will be written directly to the output document. Something to keep in mind as we go forward.
I'd suggest posting your discovery into Bugzilla -- I'm not sure whether to call it a bug or a request for enhancement -- to help ensure that we address it. Ideally, if you could come up with a minimal sample -- a dummy input document, a small extension that returns DOM trees, and a stylesheet that calls your extension enough times to demonstrate the problem -- that would be VERY helpful.
______________________________________
Joe Kesselman / IBM Research
