Infinite Loop Detection
Added by Anonymous about 16 years ago
Legacy ID: #5471989 Legacy Poster: kaiserfranz (kaiserfranz)
Is there a way to increase the maximum size of the template stack ? I am working on a project which translates a recursive functional program into an xsl-sheet. Since recursion can go very deep in some cases I would like to persuade saxon that it hasn't found an infinite loop just because some counter variable has reached the ceiling. Any way to go around that or actually change the value ? (please no suggestions featuring tail recursion...) thanx
Replies (1)
RE: Infinite Loop Detection - Added by Anonymous about 16 years ago
Legacy ID: #5472171 Legacy Poster: Michael Kay (mhkay)
Saxon doesn't count the depth of recursion: if it reports that recursion has gone too deep and is possibly infinite, that's because it's successfully trapped the Java "out of stack space" error. Basically, Saxon uses the Java stack for template and function calls, except in the case where the call can be detected as tail-recursive. You can try increasing Java stack size using the -Xss option on the java command line. However, better solutions if you want your code to be fully scalable include making it tail recursive and using divide-and-conquer algorithms.
Please register to reply