[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack Overflow Error

>   Here is what I get:
>> Error: Stack overflow.
>> Type Command-. to abort.
>   Is there a way to set the size of the system stack space?
>- Young-pa So

There is a way, but I doubt very much that it will help. The stack
almost always overflows because your code is doing infinite recursion,
not because it needs more stack. Look at the output of:


or use the Stack Backtrace dialog and look for a function that is called
multiple times with the same arguments. If you are indeed using up the stack
because of code that needs a huge amount of it, page 5 of the MCL 2.0 Release
Notes documents the :STACK-MAXIMUM and :STACK-MINIMUM keywords for the
:MEMORY-OPTIONS argument to SAVE-APPLICATION. You can also change these
values by editing the 'LSIZ' resource with ResEdit.

If you are still stumped, send me the output (or part of the output, it
will be long) from (print-call-history).

P.S. There is one other place that can sometimes cause stack overflow
even without infinite recursion. Code that recurses on both the
CAR and CDR of a list will often stack overflow when given a long
list as an argument. This code should be rewritten to recurse on
the CAR and iterate (often via a tail-call) on the CDR.