I did a bit more profiling and found that the majority of the mem allocation is in org.apache.xml.utils.SuballocatedIntVector called by SAX2DTM in the startElement method. The major of the mem allocation inside SuballocatedIntVector is in a pair of int[][] m_map and int[][] m_map0
The profiler showed that - 178,135 instances of int array were allocated and used up 458Mb - 56,009 instances of char[] were allocated and used up 106Mb it seems that for each element/node that is read and output by the SAX2DTM class, it add 1 integer into at least 6-8 instances of the SuballocatedIntVector object "m_firstch" "m_nextsib" "m_parent" "m_exptype" "m_dataOrQName" "m_prevsib" m_data m_value wow -- that was a surprise there. My Xml input file has a lilttle over 12.8 million xml element . A quick calculation (rough) show 12,800,000 * 32 bytes / 1024 / 1024 ~= 390 Mb. I wonder if there is an opportunity to tune/tweak the memory mgmt in that class or not or whether or not the array has to be kept from start-to-end of the input file for traversal purposes. Thanks in advance On Sat, Apr 3, 2010 at 11:25 AM, Toadie <toadie...@gmail.com> wrote: > Is there a way to approximate the memory footprint needed by Xalan to > run an XSL? > > For example, i am seeing that with SAX based transformation > - using Xalan 2.7.0 and java 1.6_u13 with a bootclasspath option to > force the JDK to load Xalan 2.7.0 > - an input file of size 180 meg > - and a simple XSL that does identity transformation (see below) > > The required memory footprint for heapsize is approximately 950Mb. -- > my questions are: > > 1. is there a way to approximate the required memory footprint? > 2. with SAX based processing, why does the 180Mb input file require > such high overhead of heap memory? > > _____ XSL ____ > > <?xml version='1.0' encoding='UTF-8'?> > <xsl:transform xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > version='1.0'> > > <xsl:template match="/"> > <xsl:apply-templates select="*"/> > </xsl:template> > > <xsl:template match="*"> > <xsl:copy> > <xsl:apply-templates select="@* | node()"/> > </xsl:copy> > </xsl:template> > > <xsl:template match="@*"> > <xsl:copy> > <xsl:apply-templates/> > </xsl:copy> > </xsl:template> > > </xsl:transform> >