Hi all, I believe I found the memory leak that affects Matchers and Selectors: Both (Matchers and Selectors) are selected from the respective ComponentHandler but are never released. As an attachement there's a diff to sitemap.xsl. Please take a look at it and commit it if you think it does the trick. Cheers, Christian On Sat, Aug 25, 2001 at 09:49:37PM +0200, giacomo wrote: > On Sat, 25 Aug 2001, Christian Schmitt wrote: > > > Hi all, > > we've been running some profiling tests with the Cocoon 2.0 branch > > today. > > > > One of the things we found, was that matchers and selectors are not > > released when they've been used, i.e. for every request handled > > by the sitemap there's a RequestParamMatcher created but never > > released. > > > > I'll take a look at the generated sitemap code and try to find > > out why that's happening. > > If you've found the reason and can correct it would you mind sending a > patch? > > TIA > > Giacomo > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] >
Index: sitemap.xsl =================================================================== RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v retrieving revision 1.35 diff -u -r1.35 sitemap.xsl --- sitemap.xsl 2001/08/16 07:51:37 1.35 +++ sitemap.xsl 2001/08/27 15:00:15 @@ -197,6 +197,29 @@ </xsl:for-each> /** + * Method that handles non-factory selectors. + */ + private boolean isSelected(String hint, String testValue, List listOfMaps, +Parameters params, Map objectModel) throws Exception { + boolean retVal; + Selector selector = (Selector)this.selectors.select(hint); + retVal = selector.select(substitute(listOfMaps, testValue), objectModel, +params); + this.selectors.release(selector); + return retVal; + } + + /** + * Method that handles non-factory matchers. + */ + private Map matches(String hint, String patternValue, List listOfMaps, +Parameters params, Map objectModel) throws Exception { + Map map; + Matcher matcher = (Matcher)this.matchers.select(hint); + map = matcher.match(substitute(listOfMaps, patternValue), objectModel, +params); + this.matchers.release(matcher); + return map; + } + + + /** * Pass a <code>Configuration</code> instance to this * <code>Configurable</code> class. */ @@ -646,12 +669,11 @@ <xsl:value-of select="translate($matcher-type, '- ', '__')"/>Match(<xsl:value-of select="$matcher-name2"/>_expr, objectModel, <xsl:value-of select="$component-param"/>) </xsl:when> <xsl:otherwise> - <xsl:text>((Matcher)this.matchers.select("</xsl:text><xsl:value-of select="$matcher-type"/>")).match(substitute(listOfMaps,"<xsl:value-of select="$pattern-value"/>"), objectModel, <xsl:value-of select="$component-param"/><xsl:text>)</xsl:text> + matches("<xsl:value-of select="$matcher-type"/>", "<xsl:value-of +select="$pattern-value"/>", listOfMaps, <xsl:value-of select="$component-param"/>, +objectModel) </xsl:otherwise> </xsl:choose> </xsl:variable> - <!-- this is the actual code produced --> // handling "<xsl:value-of select="@pattern"/>" if ((map = <xsl:value-of select="$matcher-name"/>) != null) { @@ -842,10 +864,11 @@ <xsl:value-of select="translate($selector-type, '- ', '__')"/>Select(<xsl:value-of select="$selector-name2"/>_expr, objectModel, <xsl:value-of select="$component-param"/>) </xsl:when> <xsl:otherwise> - <xsl:text>((Selector)this.selectors.select("</xsl:text><xsl:value-of select="$selector-type"/>")).select(substitute(listOfMaps,"<xsl:value-of select="$test-value"/>"), objectModel, <xsl:value-of select="$component-param"/><xsl:text>)</xsl:text> + isSelected("<xsl:value-of select="$selector-type"/>", "<xsl:value-of +select="$test-value"/>", listOfMaps, <xsl:value-of select="$component-param"/>, +objectModel) </xsl:otherwise> </xsl:choose> </xsl:variable> + <!-- this is the actual code produced on the when elements --> <xsl:if test="position() > 1">
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]