Obtaining with the GNU CLisp (Windows)

When I run my program, I get the message "Overflow RESET program stack" So I set up a counter to see how many times I recursively call the main function in my program. It turns out to be about 30,000 times, and the data I'm collecting is lists of about 10 elements long, which I don't think there is much. My question is, are these recursive calling and memory usage scopes common or not, or is it more likely that I am doing something wrong? I checked the vista resource manager and found that memory only grew in 1MB for the lisp.exe process. And how do I configure the CLisp limit?

+2


source to share


2 answers


http://clisp.cons.org/impnotes.html#faq-stack



Note that if you tail calls and compile your functions, there is no limitation.

+2


source


1MB appears to be the default stack size on Windows. I don't know if it can be changed without reloading the program, but in any case, I would recommend either converting the program to tail-recursive form, or using the CLisp byte compiler that will optimize it, or simply converting it to iterative form. While many Common Lisp compilers implement tail-call optimization, the standard does not require it, so unrestricted recursion should not be used.



+1


source







All Articles