Are there any common lisp implementation that allow modifying the stack size at run-time? What about the size of the heap?
I am using sbcl and apparently these are defined when the executable is started, and cannot be altered afterwards.
Are there any common lisp implementation that allow modifying the stack size at run-time? What about the size of the heap?
I am using sbcl and apparently these are defined when the executable is started, and cannot be altered afterwards.
For example ECL and LispWorks can extend the stack at runtime. One can see that both are also offering restarts when there is a stack overflow, to increase the stack size, if necessary:
ECL:
> (defun s (n)
(if (zerop n) 0 (+ 1 (s (1- n)))))
S
> (s 100000)
Condition of type: STACK-OVERFLOW
C-STACK overflow at size 4259840. Stack can probably be resized.
Available restarts:
1. (CONTINUE) Extend stack size
2. (RESTART-TOPLEVEL) Go back to Top-Level REPL.
Broken at S. In: #<process TOP-LEVEL>.
>>
See the ECL memory management documentation at: http://ecls.sourceforge.net/new-manual/re86.html
LispWorks:
CL-USER 31 > (s 1000)
Stack overflow (stack size 15997).
1 (continue) Extend stack by 50%.
2 Extend stack by 300%.
3 (abort) Return to level 0.
4 Return to top loop level 0.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
A variable in LispWorks allows customization: SYSTEM:*STACK-OVERFLOW-BEHAVIOUR*. See http://www.lispworks.com/documentation/lw61/LW/html/lw-1440.htm#marker-887330 .
The heap grows automatically in most implementations by requesting more memory from the operating system. The next question then would be: can the heap shrink?