addForeignPtrFinalizer
Simon Marlow
simonmar at microsoft.com
Wed Sep 25 08:05:45 EDT 2002
> > However, to provide a general ordering property on finalizers would
> > be quite awkward in GHC - I just can't think of an easy way to do
> > it. [Awkward ways deleted]
>
> If I understand correctly, the problem is that each FP has a cloud of
> finalizer objects attached to it with no particular structure between
> finalizer objects and the reason for this unstructured cloud
> is because you're piggy-backing on some other mechanism.
Actually in the current implementation the finalizers are not attached
to the ForeignPtr at all: it's the other way around. This paper
explains the details:
http://www.haskell.org/~simonmar/papers/weak.ps.gz
There's currently no way to get from a ForeignPtr to its list of
finalizers (well, you could do a full GC and figure it out).
Cheers,
Simon
More information about the FFI
mailing list