Hi all!

I have a serious problem with memory leaks.
In a JSP application memory consumption increases with every page
request. All pages use transformations to generate parts of the HTML.
I searched the archives and found a thread about memory leaks related to
DocumentBuilder and -Factory and TransformerFactory not beeing thread
safe. I synchronized all usage of such objects but the problem persists.
The memory profiler of Oracle JDeveloper9i shows that the following
object types are the top memory consumers. The sum of memory used by
objects of these types increases with nearly every request. Memory is
freed seldom and in small lots:

char[] and byte[] in
org.apache.xml.utils.DefaultErrorHandler.<init> line 96

int[] in
org.apache.xml.utils.SuballocatedIntVector.<init> line 126

String in
org.apache.xerces.xni.XMLString.toString line 226

org.apache.xpath.objects.XObject[] in
org.apache.xpath.VariableStack.reset line 174

These problems arise since I "ported" the application from XalanJ 1 and
XercesJ 1 to use with XalanJ 2.3.1 and Xerces 2.0.1.
The problem exists within Jdev9i debug environment and Tomcat 4.0.4. on
Win2K.

There is a helper class that holds a static DocumentBuilder. All usage 
of this DocumentBuilder is synchronized. The DocumentBuilder is created 
through a DocumentBuilderFactory in a static initializer, which should 
be run exactly once and is not specifically synchronized.
Our own transformation class that generates templates from XSL files 
(usage of TransformerFactory is synchronized) and uses the transformer 
from that template (StylesheetRoot) to do the actual transformation.


Any hints on what could be wrong are greatly appreciated.


Ralf

Reply via email to