Discussion:
How to set max stack depth in CLISP?
(too old to reply)
Paul Rubin
2020-05-16 05:10:31 UTC
Permalink
I've been having a heck of a time figuring out if there is a way to set
the max stack depth in CLISP. Per the FAQ
https://clisp.sourceforge.io/impnotes/faq.html#faq-stack

"If you really do need more Lisp stack, you can increase it by
telling CLISP to pre-allocate more memory using -m or
MT:MAKE-THREAD."

My test script is this:

(defun st (n)
(if (= n 0)
0
(1+ (st (1- n)))))
(print (st 10000))

Yes, this counts up to n stupidly on purpose. It is a test script,
after all ;-).

I've tried:

ulimit -s 200000
clisp -m 100M test.lisp

but running (st 10000) gets the error

*** - Lisp stack overflow. RESET

and the same thing happens with other combinations of limits.
Note that the "ulimit -s unlimited" causes clisp to print on startup:

Warning: reserving address range 0x80000c0000...0x1fffffffffff that
contains memory mappings. clisp might crash later!

followed by a bunch of address ranges, but then the interpreter starts
normally.

Note: I'm aware of concepts like tail recursion, CL preferring iteration
and LOOP to recursion, and all that, and am not asking about those.
This is purely an implementation question about how to configure CLISP's
stack size. Any help with that would be appreciated. Thanks!
Vladimir Sedach
2020-05-17 02:24:36 UTC
Permalink
You might try the CLISP mailing list:

clisp-***@lists.sourceforge.net

https://sourceforge.net/p/clisp/mailman/clisp-list/
--
Vladimir Sedach
Software engineering services in Los Angeles https://oneofus.la
Loading...