You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Morten Primdahl <mo...@it-c.dk> on 2002/03/21 16:40:45 UTC
Troubleshooting memory issues.
Hi. I've made a series of XSLT stylesheets for a customer.
I've tested them and they run succesfully on my workstation
with 196M RAM allocated for the VM.
On their machine, even with 1G of memory, they get out of
memory exceptions - even though the XML file being translated
is only 45M. He is using the same Xalan-2.3.1 packages that
I'm using, I'm really really puzzled by this.
I would assume that it was a memory leak in the JVM or wrong
-X settings, but he appears to have the settings right and
has tried several versions on several different OS'.
This is probably not Xalan related, but I'm curious if any
of you have ever experienced similar behaviour.
Thanks,
Morten
Re: Troubleshooting memory issues.
Posted by Morten Primdahl <mo...@it-c.dk>.
Having finally being able to reproduce the problem on
another workstation, I'm really dumbfounded. Can any of you spot
anything out of the ordinary (possibly a known bug) in the stylesheet
below that could case renegade memory usage?
I'll look more into Xalan versions etc and report back later.
On the workstation that had the mem problems I've done a succesful
run using xalan-2.2.14.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="../common.xsl"/>
<xsl:output encoding="iso-8859-1"/>
<xsl:template match="users"><xsl:apply-templates
select="user"/></xsl:template>
<xsl:template match="user"><xsl:variable name="pos"
select="position()"/>CCS_ACCOUNT,"<xsl:value-of
select="@id"/>","<xsl:call-template name="prepareLoad"><xsl:with-param
name="string"><xsl:value-of
select="name/first"/></xsl:with-param></xsl:call-template>","<xsl:value-of
select="name/last"/>","<xsl:value-of select="address"/>","<xsl:value-of
select="zip"/>", "<xsl:value-of select="phones/work"/>","<xsl:value-of
select="phones/fax"/>","<xsl:value-of select="mail"/>","<xsl:value-of
select="password"/>","<xsl:apply-templates
select="registered"/>","<xsl:apply-templates
select="active"/>",<xsl:value-of select="1000+$pos"/><xsl:text>
</xsl:text><xsl:value-of select="1000+$pos"/>,cv,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="cv"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,sex,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="sex"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,cellular,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="cellular"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,title,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="title"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,slogan,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="slogan"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,companywww,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="companywww"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,birthday,"<xsl:apply-templates
select="birthday"/>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,list,"<xsl:choose><xsl:when
test="list">Y</xsl:when><xsl:otherwise>N</xsl:otherwise></xsl:choose>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,imageurl,"<xsl:value-of
select="imageurl"/>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,homepage,"<xsl:value-of
select="homepage"/>"<xsl:text>||
</xsl:text>
<xsl:value-of select="1000+$pos"/>,company,"<xsl:call-template
name="prepareLoad"><xsl:with-param name="string"><xsl:value-of
select="company"/></xsl:with-param></xsl:call-template>"<xsl:text>||
</xsl:text>
</xsl:template>
<xsl:template match="birthday"><xsl:choose><xsl:when
test="string"><xsl:value-of
select="string"/></xsl:when><xsl:otherwise><xsl:value-of
select="year"/><xsl:text>-</xsl:text><xsl:value-of
select="month"/><xsl:text>-</xsl:text><xsl:value-of
select="day"/></xsl:otherwise></xsl:choose></xsl:template>
<xsl:template match="male">M</xsl:template>
<xsl:template match="female">F</xsl:template>
<xsl:template match="registered"><xsl:apply-templates
select="date"/><xsl:text> </xsl:text><xsl:apply-templates
select="time"/></xsl:template>
<xsl:template match="active"><xsl:apply-templates
select="date"/><xsl:text> </xsl:text><xsl:apply-templates
select="time"/></xsl:template>
<xsl:template match="date"><xsl:apply-templates
select="day"/>-<xsl:apply-templates
select="month"/>-<xsl:apply-templates select="year"/></xsl:template>
<xsl:template match="time"><xsl:apply-templates
select="hours"/>:<xsl:apply-templates
select="min"/>:<xsl:apply-templates select="sec"/></xsl:template>
</xsl:stylesheet>
And the imported template:
<xsl:template name="prepareLoad">
<xsl:param name="string" />
<xsl:choose>
<xsl:when test="contains($string, '"')">
<xsl:value-of select="substring-before($string, '"')"
/><xsl:text>""</xsl:text>
<xsl:call-template name="prepareLoad">
<xsl:with-param name="string"
select="substring(substring-after($string, '"'), 1)" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>