I can't see any obvious reason why calling saxon:discard-document() on the lookup document at the end of processing shouldn't work. It should certainly make the lookup document available for garbage collection, and I think that it should also make the index eligible for gc as well. There's always a possibility that there are some references to nodes in the lookup document somewhere, however. And of course, being eligible for garbage collection isn't the same as being garbage-collected. Have you tried doing a jHat heap analysis?

Michael Kay

On 28/02/2012 15:24, David Rudel wrote:

I have an XSL stylesheet that processes many source documents one at a time. Each source document is related to a separate lookup document.

These lookup documents are referenced many times, so I have used a key to speed up the performance.

Unfortunately, I don't know how ask the processor to flush the memory associated with the indexed lookup table after I am through using it.

I tried key('keyname', 'keyvalue', saxon:discard-document('lookup.xml')), but that appeared to defeat the purpose of creating the key in the first place. The performance was highly degraded, and I can only assume the problem is that the processor immediately flushes the memory after the command.

I also tried putting a <xsl:value-of select="saxon:discard-document(document('look-up.xml'))/a" /> at the end of each process loop (there is no "/a" node in lookup.xml), hoping that it would let the processor know that I no longer cared about look-up.xml. That trick has worked in the past (e.g., when I needed to use "doc-available" and then had to make sure afterward that the document was flushed from memory.



"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.

Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!

saxon-help mailing list archived at http://saxon.markmail.org/