Menu

#21 Variable score -> memory leak

open
nobody
None
5
2013-01-15
2005-12-22
Mikael
No

Given:

<xsl:template name="test">
<xsl:variable name="var1">
<xsl:variable name="leak_source">
<xsl:value-of select="'hello'"/>
</xsl:variable>
</xsl:variable>

<xsl:variable name="var2">
<xsl:variable name="leak_source">
<xsl:value-of select"' world'"/>
</xsl:variable>
</xsl:variable>

<xsl:value-of select="concat($var1, $var2)"/>
</xsl:template>

...any call to the xsl:template 'test' will lead to a
memory leak. XMLPartner does not distinguish between
separate occurrences of the xsl:variable 'leak_source',
and resource are only freed once - but allocated twice
(or so I deduct, I haven't been able to follow this
through in the source code, these are just my
observations from modifying my XSL documents).

Therefore: no code fix (assuming this *is* a bug -
MSXML has no such problems), but as a work-around, but
careful to give different names to closely occuring
nested xsl:variables.

Discussion


Log in to post a comment.