This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: guile stack problems



>>>>>> "Nat" == Nat Friedman <ndf@ALEPH1.MIT.EDU> writes:
>
>    Nat> If you're not the proper person to contact about this, then
>    Nat> please pass it along to whomever is, or let me know. . .
>
>    Nat> Guile gives me stack overflows if I call it in this program:
>
>    Nat> #include <guile/gh.h>
>
>    Nat> void my_main(int argc, char ** argv) { int foo[281880];
>    Nat> gh_eval_str("(display \"hello world\n\")"); }
> 
>    Nat> int main(int argc, char ** argv) { gh_enter(argc, argv,
>    Nat> my_main); }
>
>    Nat> -Nat

Right: you've declared a huge array on the stack, and Guile is
concerned that you'll overflow it.  What's the problem here?

If Guile is being too conservative, the stack size limit is one of the
debug options; you can set it like this:

totoro:jimb$ guile
guile> (debug-options #t) 
stack           20000   Stack size limit (0 = no check).
debug           yes     Use the debugging evaluator.
backtrace       no      Show backtrace on error.
depth           20      Maximal length of printed backtrace.
maxdepth        1000    Maximal number of stored backtrace frames.
frames          3       Maximum number of tail-recursive frames in backtrace.
indent          10      Maximal indentation in backtrace.
backwards       no      Display backtrace in anti-chronological order.
procnames       yes     Record procedure names at definition.
trace           no      *Trace mode.
breakpoints     no      *Check for breakpoints.
cheap           yes     *Flyweight representation of the stack at traps.
guile> (debug-set! stack 100000)
(stack 100000 debug depth 20 maxdepth 1000 frames 3 indent 10 procnames cheap)
guile>