Simon Marlow simonmar at
Thu Sep 26 04:56:20 EDT 2002

> > Actually in the current implementation the finalizers are not
> > attached to the ForeignPtr at all: it's the other way around. 
> Ah, I see.
> Fortunately, I don't think my sketched implementation depended on such
> an attachment since it added an attachment of its own.  The design is
> intended to sit on top of the current GHC implementation (i.e., one
> with Haskell finalizers and no control over the order they are run).

Yes, you're right.  We could do it that way.  I'm also concerned about
adding the extra overhead though, especially if this is something that
will rarely be needed.  Are we sure this is what we want?

At least I can optimise mallocForeignPtr again and avoid registering the
finalizer until the first call to addForeignPtrFinalizer.


More information about the FFI mailing list