[Top][All Lists]

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

Re: [Chicken-users] Unbounded stack growth

From: Alex Shinn
Subject: Re: [Chicken-users] Unbounded stack growth
Date: Thu, 12 Jul 2012 12:24:21 +0900

On Thu, Jul 12, 2012 at 11:55 AM, Matthew Flatt <address@hidden> wrote:
> At Thu, 12 Jul 2012 11:25:44 +0900, Alex Shinn wrote:
>> I disagree - I think a stack grown too large is likely indicative
>> of a programming error, or at the very least an inefficient
>> algorithm.  In the general case I want my programs to be
>> able to allocate as much heap as possible, but have a
>> separate limitation on the stack.
> Amen. Just because a computation is naturally expressed as a recursion
> does not mean that you should write it that way.


Unfortunately we don't live in a perfect world,
and our computers have nasty limitations.  Even
if they didn't, infinite loops are easy to write, and
the halting problem thwarts our attempts to
detect these.

Racket will happily allocate all available memory
on this problem and thrash for a while before
aborting with an out-of-memory error, and if you're
lucky no other victims have fallen to the whimsical
Linux OOM killer.

Chibi will fairly early on raise a (continuable) out
of stack exception.  I suppose it might be nicer
if the stack limitations were fully configurable and
the default repl prompted you if you wanted to
continue with a larger limit in these cases. I may
add that, but in the meantime I prefer the current
behavior to unbounded growth.

Halting problem aside, some attempts at runtime
detection of loops, or scaling stack space with
the size of inputs might be nice.


reply via email to

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