Why do we have stack overflows?
ahey at iee.org
Tue May 8 06:54:56 EDT 2007
Simon Marlow wrote:
> I'm more than happy to change the defaults, if there's some agreement on
> what the defaults should be. The current choice is somewhat historical
> - we used to have a bound on both heap size and stack size, but the heap
> size bound was removed because we felt that on balance it made life
> easier for more people, at the expense of a bit more pain when you write
> a leaky program.
Well in the light of what Stefan says about exponentially increasing
stack size I'm not sure increasing (or removing) the default is the
answer. Going from 16M to 32M to 64M stacks is bit drastic. It seems
to me going up in sane sized linear increments would be better.
But since we also want to avoid frequent copying of an already oversized
stack I guess some linked list representation is what's needed. In fact
I'd think what Stefan suggests or something very similar would be the
way to go. But I have no idea how much work that would be.
But to give programs best possible chance of running successfully then I
think an (optional) overall limit on total memory use would be
preferable (better than trying to guess how much stack space will be
needed in advance).
More information about the Glasgow-haskell-users