Why do we have stack overflows?

Brandon Michael Moore brandon at heave.ugcs.caltech.edu
Thu May 3 20:36:45 EDT 2007


On Thu, May 03, 2007 at 04:59:58PM -0700, 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.

Isn't it just the top of the stack that has to be treadted as a root?
(maybe you need to walk the stack to find exception handlers and so on.)
Maybe it shouldn't be so much worse than a heap. The Chicken Scheme
system allocates everything on the C stack, and runs some sort of
compacting collector when it is about to fill.

Brandon


More information about the Glasgow-haskell-users mailing list