Finalizers etcetera

Ross Paterson ross at soi.city.ac.uk
Wed Oct 9 09:52:34 EDT 2002


On Wed, Oct 09, 2002 at 02:02:35PM +0100, Alastair Reid wrote:
> 
> > So are you saying that if a GC were to occur in the middle of a
> > C-implemented Hugs primitive, it could be bad news? 
> 
> It's possible.  It's something we never had to consider when writing
> the Hugs primitives so we never took care to protect against it.

I thought you did.  Every time you allocate a cell in Hugs, it's a
potential GC, and Hugs is very careful that any heap pointers in use
will be visible to the garbage collector.  What hasn't been required
is for the various data structures to be in a consistent state at that
point, and Haskell finalizers might trip over those if run after GC.
SimonM's patch ran them at a different point, though.



More information about the FFI mailing list