Hello dear Xalan users,
I use Ant (1.5.1), Xalan (2.4.1) and Xerces (2.2.1) to do some XHTML2XHTML
transformations. After adding some document()-functions, I quickly ran out of
memory, receiving a java.lang.OutOfMemoryError.
None of the documents is huge or even big in size, all documents are
well-formed, all XHTML documents are valid.
I temporarily work-around the problem by using ANT_OPTS="$ANT_OPTS -Xmx256M"
in my ~/.antrc.
To get an impression of what my stylesheets look like, I've added a code
snippet:
<xsl:template name="createNavigation">
<xsl:for-each
select="document('../conf/site.xml')/site/pagesequence/pageref">
<xsl:variable name="id" select="@id"/><!-- introduced because
using current() threw a NullPointerException in img's alt attribute -->
<a
href="/{document('../conf/site.xml')/site/pagedefs/[EMAIL PROTECTED]/[EMAIL
PROTECTED]'de']/@href}">
<img
src="/gfx/{document('../conf/site.xml')/site/pagedefs/[EMAIL PROTECTED]/[EMAIL
PROTECTED]'de']/@href}_button.png"
alt="{document(concat('../htdocs/',
document('../conf/site.xml')/site/pagedefs/[EMAIL PROTECTED]/[EMAIL
PROTECTED]'de']/@href,
'.php'))/html:html/html:head/html:[EMAIL PROTECTED]'ITCQIS' and
@name='buttontext']/@content}"
class="decorblock"
/>
</a>
</xsl:for-each>
</xsl:template>
I use an Ant script with an XML Catalog. It invokes XMLValidate, XSLT and
XMLValidate again. It also invokes Rasterize, but the memory footprint of
Rasterize is quite low, especially compared with XSLT.
When the build.xml had to transform the 11th document, it ran out of memory.
Memory consumption exceeded 90 MBytes.
When following memory consumption using top I detected that the memory usage
increases by approximately 15 MBytes per transformation and goes far beyond
120 MBytes - just for validating, transforming and again validating 11 files.
It seems that many objects do not get garbage collected because unneccessary
references to them remain.
I profiled the application. When profiled, the application once needed 212
MBytes of RAM (whereas part of the memory is, of course, consumed by the
profiler itself).
Has anyone else experienced such memory problems?
I can send a memory profile (gzipped, of course, still >1MB) or even give a
login to my machine to view it locally, including all scripts.
Bye
--
ITCQIS GmbH
Christian Wolfgang Hujer
GeschÃftsfÃhrender Gesellschafter
Telefon: +49 (0)89 27 37 04 37
Telefax: +49 (0)89 27 37 04 39
E-Mail: [EMAIL PROTECTED]
WWW: http://www.itcqis.com/