Thomas Bushnell BSG scripsit:

> So this raises a question.  Scheme functions get compiled into code that
> carefully checks stack bounds before allocating, and bangs off to the
> garbage collector if necessary.
> 
> The FFI doesn't do this.  So I'm assuming that in fact, I have the full
> C stack available, and can just go ahead and use it.  When I invoke the
> return continuation, it will go just fine, and presumably if I've
> exceeded the Chicken stack size, it will just trigger a gc and proceed
> happily as before.

In fact, it's unpredictable how much C stack you have, because each compiled
Scheme function invokes its successor, leaving garbage return addresses,
saved registers, etc. on the C stack.  So just before calling a function
that allocates lots of C stack, call (gc #f) to force a minor GC.  
Alternatively,
use the -nursery switch at compile time or the -:s switch at run time to
force a large stack.

-- 
John Cowan    [email protected]    http://ccil.org/~cowan
Heckler: "Go on, Al, tell 'em all you know.  It won't take long."
Al Smith: "I'll tell 'em all we *both* know.  It won't take any longer."


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to