[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] memory leaks after java-calls


Subject: [xsl] memory leaks after java-calls
From: "Lensch, Thomas" <Lensch@xxxxxxxx>
Date: Thu, 15 Feb 2007 13:00:49 +0100

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


Current Thread
Keywords
xsl