[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How is memory allocated in recursive XSLT template

Subject: Re: How is memory allocated in recursive XSLT templates?
From: "Rashmi Rubdi" <rashmi.sub@xxxxxxxxx>
Date: Wed, 2 May 2007 19:31:36 -0400
Re:  How is memory allocated in recursive XSLT template
On 5/2/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> -Xss###k did not
> help anything, which makes me believe that the maximum
> recursive depth is enforced by Saxon somehow.
>

Initially I too thought -Xss didn't work, but it works on Saxon.


So I tried

java -Xss8192k -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it mainTemplate
recursion.xsl

with this stylesheet

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
			      xmlns:xs="http://www.w3.org/2001/XMLSchema"
			      xmlns:f="http://factorial.com/">

<xsl:output omit-xml-declaration="yes"/>

<xsl:template name="mainTemplate">
 <xsl:value-of select="f:fac(10446)"/>	
</xsl:template>

<xsl:function name="f:fac">
     <xsl:param name="nr"/>
     <xsl:sequence select="if($nr = 0) then 1 else f:fac($nr -1) * $nr" />
</xsl:function>

</xsl:stylesheet>

and it gave the output similar to the Java Factorial program, however
I couldn't and didn't want to measure the time because the time
measurement is not precise anyway.


No, Saxon doesn't enforce any limit.


I'm not sure -Xss works in all environments. See for example

http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=4e8e9b5ea8255ffffffff
c30b7a19a079137:WuuT?bug_id=6316197

I tested the above on java version "1.6.0_01"


Please note that -Xss8192k is not the ~minimum~ required memory to run
the above factorial.

I think the minimum would be lower, but I still need to approximate it.

Michael Kay
http://www.saxonica.com/


-Regards Rashmi

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.