Why do we have stack overflows?

Adrian Hey ahey at iee.org
Fri May 4 09:11:28 EDT 2007

John Meacham wrote:
> I believe it is because a stack cannot be garbage collected, and must be
> traversed as roots for every garbage collection. I don't think there are
> any issues with a huge stack per se, but it does not play nice with
> garbage collection so may hurt your performance and memory usage in
> unforeseen ways.

I'm still not convinced :-(

I also don't believe it's in anybodys interest to have programs
failing for no good reason. A good reason to fail is if overall
memory demands are getting stupid. Failing because the stack has
grown beyond some arbitrary (and typically small) size seems
bad to me.

I know that this is to a certain extent this is controllable
using RTS options, but this is no use to me as a library
writer tying to chose between stackGobbler and heapGobbler.

The stuff should "just work" and not be dependent on the right
RTS incantations being used when the final program is run.

Adrian Hey

More information about the Glasgow-haskell-users mailing list