> grepping through sources suggests that nobody tried to implement this,
> only the exception constructor exists... OTOH stack overflow works.
>
> import Exception
> main:: IO ()
> main = print (length (l++l)) `catchAllIO` print
> where l = [0::Int ..]
Yes, I know: heap overflow is somewhat trickier than stack overflow. If the
stack overflows, at least you know that by raising an exception you're going
to reduce the size of the stack, the same isn't true of heap overflow, so
you need some kind of "soft limit" after which the exception is thrown.
And which thread should get the exception? All of them? Just the one that
was allocating at the time? The main thread? (this reminds me of one of
the great open questions in OS design: if you run out of memory, which
process do you kill?). Perhaps a thread should have to register in order to
receive the heapOverflow exception, or maybe you should install a "heap
overflow handler", like a signal handler. Comments?
Cheers,
Simon