Repeated calls to installHandler

Simon Marlow simonmar at microsoft.com
Wed Nov 21 05:01:42 EST 2001


> If `installHandler' is called more than a few times in a row, the
> run-time system terminates with an error message.
> 
> The program:
> 
>     main =
>         sequence_ $
>             replicate 33 $
>                 installHandler sigINT (Catch (return ())) Nothing
> 
> The shell output:
> 
>     % ./program
>     program: fatal error: getStablePtr: too light

This is due to the fact that installHandler creates a StablePtr to the
handler, and our StablePtr implementation currently uses a weighted
reference counting mechanism which means that making more than 32 stable
pointers to the same object can exhaust the reference count.

Since we've never really used the weighted reference counter for
anything useful (it was designed that way so that the StablePtr
implementation would also serve as the global address table in the
parallel/distributed versions of GHC) I think I'll remove it.

Cheers,
	Simon




More information about the Glasgow-haskell-bugs mailing list