Ralf Hinze writes:
> Dear Alastair,
> 
> while playing around with the stack size the following error croped
> up:
> 
> Prelude> foldl (\n _ -> n + 1) 0 [1..1000]
> 1000
> Prelude> foldl (\n _ -> n + 1) 0 [1..10000]
> 
> ERROR: Control stack overflow
> Prelude> foldl (\n _ -> n + 1) 0 [1..100000]
> Segmentation fault (core dumped)

We ought to be catching the relevant signal (shouldn't we, Mark?)
I'll go have a look at why we're not.

> BTW it would be truely wonderful if Hugs provided a way to increase the
> stack size using a command line option. 

The merged Hugs-GHC system will address this kind of problem in two ways:

1) The stack will be stored on the heap.
   (We have to do this to provide true concurrency in Concurrent.forkIO)

2) The heap need not be a single contiguous block of memory - so we'll
   have much more flexibility in how we respond to heap/stack overflows.
   eg We can keep mallocing more heap space till we reach some hard limit,
   till we reach a machine limit or until the VM system starts swapping pages
   too much.

We also plan to put bytecodes in the heap (so one less wired-in limitation)
 and to use a multigenerational collector (so the GC won't spend all its
 time moving the code objects around in memory).


Alastair

Reply via email to