[Haskell-cafe] Re: Are handles garbage-collected?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Oct 26 07:17:17 EDT 2004

"Simon Marlow" <simonmar at microsoft.com> writes:

> > C finalisers are run during garbage collection, Haskell finalisers
> > are run immediately afterwards.  In fact, you cannot run a Haskell
> > finaliser during GC, because you don't have a valid heap to run it in.
> But don't you run into problems in the implementation of
> newConcForeignPtr, when the Haskell finalizer needs the value of a thunk
> that was already under evaluation when the GC happened?  ie. the need
> for concurrency that stopped this from becoming part of the official FFI.

Yeah, sure, there are necessary restrictions on the nature of Haskell
finalisers in our implementation, and if we wanted to fix them,
e.g. with locks, it could get quite messy internally.

My point wasn't really about Haskell finalisers, more about your
statement that Hugs and nhc98 fun their finalisers immediately post-GC
as a direct consequence of them *not* being written in Haskell,
which I think was a slightly misleading statement.


More information about the Haskell-Cafe mailing list