Proposed change to ForeignPtr

Simon Marlow simonmar at
Tue Sep 10 10:58:20 EDT 2002

Malcolm says:
> I don't see the problem.  The Foogle garbage collector runs separately
> and asynchronously to the Haskell GC.  A Foogle object is released
> by the Haskell collector, then at a later moment in time, a Haskell
> object is released by the Foogle collector.  Where is the conflict?

Foogle might be doing reference counting instead of GC, so it might want
to run the finalizer synchronously.

George: the problem with allowing callbacks from a finalizer is that in
order to implement this your system essentially has to be able to make a
pre-emptive context switch from the currently running Haskell
computation to the finalizer; this turned out to have a fairly high
implementation cost for nhc98 and Hugs, so we decided to amend the spec
instead.  You'll still be able to do this in GHC, of course, but it
won't be portable.


More information about the FFI mailing list