You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/11/22 20:15:12 UTC
DO NOT REPLY [Bug 14778] New: -
"Memory Leak" in XalanJ2
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14778>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14778
"Memory Leak" in XalanJ2
Summary: "Memory Leak" in XalanJ2
Product: XalanJ2
Version: 2.0.0
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Blocker
Priority: Other
Component: org.apache.xalan.xsltc
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: pankaj.verma@corporate.ge.com
CC: manindra.tiwary@corporate.ge.com
We are facing a memory leak problem while doing transformation using xalan java
version 2. We are using templates which are cached on the server disk for the
transformation.
Here is the sample code that we are using.
To create a template:
public Templates getTemplate(String p_strXslUri) throws Exception {
TransformerFactory tFactory = TransformerFactory.newInstance();
StreamSource stylesource = new StreamSource(p_strXslUri);
return tFactory.newTemplates(stylesource);
}
For debugging we printed out the instance of tFactory and it is :
org.apache.xalan.xsltc.trax.TransformerFactoryImpl
After this, template is put in the disk cache and used for further
transformation.
This is the method that we use for the transformation:
public static String transformUsingTemplates(Templates template, String
xmlFile) throws TransformerException,
TransformerConfigurationException, FileNotFoundException, IOException,
Exception {
StringWriter sos = new StringWriter();
StreamResult streamresult = new StreamResult(sos);
try {
Transformer transformer = template.newTransformer();
StreamSource XMLsource = new StreamSource(new StringReader
(xmlFile));
transformer.transform(XMLsource, streamresult);
return (sos.toString());
}
catch (Exception e) {
throw e;
}
}
We tried to do a load test of the application running 25 concurrent user for
one hour. It ran well for a while, but memory usage kept increasing and after
some time the server stopped responding. We ran a profiler to find out the
bottle neck and this is the result we got.
XSLUtility.transformUsingTemplates()
Execution Count : 4,880
Temporary Bytes : 1,569,938,728 Bytes
Temporary Objects : 4,055,784
Short-lived Bytes : 1,569,938,728 Bytes
Short-lived Objects : 4,055,784
Medium-lived Bytes : 0 Bytes
Medium-lived Objects : 0
Long-lived Bytes : 888,751,648 Bytes
Long-lived Objects : 653,812
It�s the long lived bytes and objects that are eating up the memory. (total 15
templates were created in the whole process)
We are using WAS 4.0.1 AE on Win2k. Details of the jar file we are using
(filename / size/ modified) :
Xalan.jar 886kb 2/20/2002 6:25pm
Xercesimpl.jar 1689kb 3/7/2002 10:21pm
Xml-apis.jar 106kb 2/19/2002 4:31pm
Xmlparserapis.jar 129kb 3/7/2002 10:21pm
Please let us know if there is something wrong in what we are doing or there is
a memory leak in the transformer implementation in xalan-J2? And what is the
resolution for this problem?