ANN: H98 FFI Addendum 1.0, Release Candidate 7

Ross Paterson ross at
Fri Sep 20 06:00:59 EDT 2002

Alastair Reid <alastair at> wrote:
> I guess the issue is that if someone wanted to use
> as a finalizer they would not be able to do so.  Since we don't
> guarantee that MarshalAlloc.malloc is "stdio.h malloc", they couldn't 
> portably cons up a compatible &free.

Yes, you're trying to recover something that was lost with the change
to newForeignPtr.  Formerly one could allocate something with malloc
or mallocArray and add a finalizer that called free.  Now you can't,
except in the canned special case of mallocForeignPtr.  But there's
nothing similar for arrays, as required e.g. in Data.Array.Storable.

More information about the FFI mailing list