Hi

I think I discovered a memory leak while an XPath query is executed using
Xindice 1.2 dev svn revision number 821662.

I only had to run a query that generated a sufficiently large number of
results.

After some debugging I discovered that in class XPathQueryResolver.ResultSet

the XPathResolverContext member variable is cached now as opposed to as it
was in its previous version.
This is probably for performance reasons.

This class XPathResolverContext has internally a DTMManager implementation.
As ResultSet.prepareNextNode method is called many times (while one query is
executed),  the DTMManager instance will grow and grow in size until JVM
runs out of memory.

Calling XPathResolverContext .reset() in ResultSet.prepareNextNode would
solve this problem but it would be against the intent of optimizing the
code.


I am not familiar yet with Xalan's DTM API to provide a proper solution. So
i am just speculating here:
Internally DTMManager caches DTM objects generated while it executed the
query on a given context. These DTMs consume the memory.
I think these are cached to be reused by the two-way iterators provided by
DTMManager.
However in Xindice, the Collection API provides the NodeSet as forward only
iterator, thus no DTM caching is need for Xindice. ?


regards,
Ferenc

Reply via email to