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

Memory leak when using p:xslt in 1.0.20 -> 1.0.23 #183

Closed
AdrianBuza opened this issue Dec 18, 2014 · 5 comments
Closed

Memory leak when using p:xslt in 1.0.20 -> 1.0.23 #183

AdrianBuza opened this issue Dec 18, 2014 · 5 comments

Comments

@AdrianBuza
Copy link

@AdrianBuza AdrianBuza commented Dec 18, 2014

I tested and reproduced this in 1.0.20 -> 1.0.23.

We run XProc scripts repeatedly within the same Java process (not headless). After a few runs of scripts that use p:xslt, a significant amount of memory remains allocated that is directly proportional to the size of the input XML source file and the number of p:xslt steps.
This did not happen with 1.0.19 and earlier.

XProc (add more p:xslt steps to amplify the problem):

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="1.0">
    <p:input port="source"/>
    <p:output port="result"/>


    <!-- Step1. -->
    <p:xslt name="step1">
        <p:input port="source"/>
        <p:input port="stylesheet">
            <p:document href="dummy.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>

    <!-- Step2. -->
    <p:xslt name="step2">
        <p:input port="stylesheet">
            <p:document href="dummy.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>
    .... (more steps)
</p:declare-step>

XSL is not really relevant, but I'm including it here for completeness' sake, dummy.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template match="*"/>
</xsl:stylesheet>

Use a large input XML (>3MB) and check the Java heap after a few runs.

@AdrianBuza
Copy link
Author

@AdrianBuza AdrianBuza commented Mar 24, 2015

Hi,

Is there any feedback regarding this leak?
This is rather important for us at Oxygen, since XML Calabash runs within the Java process of our Oxygen application. This means that a memory leak stays with the application until it is restarted. After a few XProc runs that use p:xslt, the application may run out of memory due to the repeated leaks.

Regards,
Adrian

@ndw
Copy link
Owner

@ndw ndw commented Mar 27, 2015

Top of my list, I promise. I've got some personal distractions this weekend (my mother is visiting :-) ) but I'll try to get this fixed next week. Certainly for the next release. Sorry about the delay.

@ndw
Copy link
Owner

@ndw ndw commented Apr 3, 2015

Ok. I've found the issue. My first attempt at fixing it seems to cause a regression error in extension functions. As soon as I've nailed that down, I'll do another release.

ndw added a commit that referenced this issue Apr 6, 2015
ndw added a commit that referenced this issue Apr 6, 2015
@ndw
Copy link
Owner

@ndw ndw commented Apr 6, 2015

I believe this is fixed in 1.0.32 released today.

@ndw ndw closed this Apr 6, 2015
@ndw
Copy link
Owner

@ndw ndw commented Apr 6, 2015

Note that you must call runtime.close() when you're through using an XProcRuntime.

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.