Finalizers: the Legend that Won't Die

Malcolm Wallace Malcolm.Wallace at
Thu Feb 27 12:45:24 EST 2003

George Russell <ger at> writes:

> Is it safe to run runFinalizers anywhere except in the main IO trunk? 

This is the first question that occurred to me too.

> let
>     x = seq (unsafePerformIO runFinalizers) y
>     finalizer = [... something involving x ...]
> Otherwise you always have the risk of coming a cropper on blackholed values,
> don't you?

But isn't this just the same as any other program that contains a
blackhole fault?  i.e. the program is logically incorrect.  What is
more, the runtime system will probably tell you "Blackhole detected!"
or "<<loop>>" or something, which is helpful.

So I don't see why this sort of program would become particularly
more common than it currently is, if the runFinalizers() procedure
is added to the FFI spec.


More information about the FFI mailing list