Page 1 of 1
How to add stack size when -x code to executable file
Posted: Sun Jul 31, 2016 1:03 pm
by ssqq
Code: Select all
ERR: call or result stack overflow in function set : term
When I see this error, I think the stack size is too small. How to enlarge it in default?
Re: How to add stack size when -x code to executable file
Posted: Fri Aug 05, 2016 12:45 pm
by rickyboy
Hmmm. I've never done this. But before you try anything with linking, first confirm that adding more stack space will solve your issue.
If something like the above works (for the appropriate value of -s, of course), only then proceed to the following
I assume you are linking your code to the newlisp executable (because you mention -x in your subject line), i.e. you are doing this:
Have you tried the following?
If that doesn't work, you could try building a version of newLISP that has the stack space you want as the default. (This will of course mean that you will patch a bit of the C code -- probably one line, but I haven't seen the code in ages.) Now, you should be able to link your newlisp source file with the newly built `newlisp` executable and get the extra stack space you need.
Re: How to add stack size when -x code to executable file
Posted: Fri Aug 05, 2016 5:11 pm
by ssqq
I found my stack over flow is code design have problem, when call a function with recursive over 50> times, would occur this error.
Code: Select all
> (define (call x) (cond ((= x 1) x) (true (dec x) (+ x (call x)))))
> (call 1000)
ERROR: stack over flow