[Top][All Lists]

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

Re: [Chicken-users] Unbounded stack growth

From: John Cowan
Subject: Re: [Chicken-users] Unbounded stack growth
Date: Wed, 11 Jul 2012 14:31:58 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Marc Feeley scripsit:

> In this example, there will be an arbitrarily long sequence of C calls
> (in the unwinding of the recursion to even) with no Scheme call, so
> stack size checks will not be performed during the unwinding, yet the
> C stack grows during the unwinding.  There is no stack overflow during
> the winding phase of the recursion because the stack size checks are
> performed at regular intervals (at each entry to even).

While you're right, it's not clear that this matters enough to fix.
It's not a *correctness* error, since every implementation will blow up
on excessive recursion sooner or later when memory is exhausted.

If the overflow check were done, the maximum recursion depth would be
bounded by the C heap, not the C stack.  However, inserting all those
checks has a cost.  So it would be a question of measuring the added cost
of the checks over a large variety of programs.  If it's consistently
small, they should be added; if not, there should be an option to provide
them or to turn them off.

John Cowan              address@hidden
Any day you get all five woodpeckers is a good day.  --Elliotte Rusty Harold

reply via email to

[Prev in Thread] Current Thread [Next in Thread]