xsl-list
[Top] [All Lists]

[xsl] memory leaks after java-calls

2007-02-15 05:01:22
Hi,

i'm using xalan (2.6.0), xerces (2.6.2).

My xsl script calls java:

java:de.juris.util.SimpleHTMLDiff.getSimpleHTMLDiffAsDOM($in1, $in2)

$in1 and $in2 contain some data (String).

The java code looks as follows:

public static DocumentFragment getSimpleHTMLDiffAsDOM(String left,
String right) {
 // do something with these Strings, result kept in String fragment
 // and then:
                        // Create a DOM builder and parse the fragment
                        DocumentBuilder dBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
                        dBuilder.setErrorHandler(null);
                        Document d = dBuilder.parse(new InputSource(new
StringReader(fragment)));

                        DocumentFragment docfrag =
d.createDocumentFragment();
                        Node node = d.getDocumentElement();

                        // Move the nodes into the fragment
                        while (node.hasChildNodes())
                        {
        
docfrag.appendChild(node.removeChild(node.getFirstChild()));
                        }

                        // Return the fragment
                        
                        return docfrag;
}

Because xalan runs in an web (tomcat) environment many of these calls
come in and used memory grows.

It seems that all these docfrags are kept in memory, isn't it?
Does the garbage collector find all these docfrags which aren't needed
any more?
Is it possible to change this behaviour so that the docfrags are deleted
in memory?

Best regards,
Thomas

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • [xsl] memory leaks after java-calls, Lensch, Thomas <=