The Revenge of Finalizers

Simon Marlow simonmar at
Thu Oct 17 05:09:06 EDT 2002

> There's another problem with Simon's patch I haven't been able to pin
> down: if you run the example, interrupt it at the right point and type
> another expression, the finalizers run, but the expression is lost.

I can get it to fail another way too:

  main = do
    p <- mallocBytes 64
    newForeignPtr p (print x)
    print x
    x = sum [1..10000]

Can't believe I didn't realise this kind of thing might be a problem
before... guess I was too fixated on the other issues.  Anyway, it
really needs someone who is familiar with the Hugs backend to comment on
whether either of these problems are fixable or not.

This one I think you could trigger by using the
unsafePerformIO->C->Haskell sequence too.


More information about the FFI mailing list