Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSLT step leaks memory when a SaxonApiException is thrown on a stylesheet compile #108

Closed
rama-nallamilli opened this issue Jul 5, 2013 · 1 comment

Comments

@rama-nallamilli
Copy link

@rama-nallamilli rama-nallamilli commented Jul 5, 2013

XSLT step leaks memory when a SaxonApiException is thrown on a stylesheet compile

We are currently reusing the XPipeline instance for multiple executions with calls originating from a single JVM, however under certain error conditions we have experienced memory leaks. We have investigated further and found the culprit was in XLST.java

    config.setCollectionURIResolver(new CollectionResolver(runtime, defaultCollection, collectionResolver));

The previous collection resolver is restored after the stylesheet compile allowing the JVM to cleanup the above temporary created CollectionResolver:

    config.setCollectionURIResolver(collectionResolver);

However if an exception occurs during the stylesheet compile this step above is not performed leaving a new CollectionResolver in memory referencing the previous instance, this repeats for each subsequent execution leading to a large memory leak. Further analysis has shown another instance of this bug to be present is XQuery.java.

A quick workaround would be to move the statement config.setCollectionURIResolver(collectionResolver); into a finally block after the stylesheet compilation.

ndw added a commit that referenced this issue Jul 26, 2013
ndw added a commit that referenced this issue Jul 26, 2013
@ndw
Copy link
Owner

@ndw ndw commented Jul 26, 2013

I think that does it. Let me know if you find I'm mistaken.

@ndw ndw closed this Jul 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.