[Haskell-cafe] FFI woes!

Keean Schupke k.schupke at imperial.ac.uk
Thu Dec 16 09:52:19 EST 2004


Udo Stenzel wrote:

>Robert Dockins <robdockins at fastmail.fm> schrieb am 16.12.04 14:56:49:
>
>  
>
>>This is exactly the guarantee you _don't_ have.  The only guarantee you 
>>have is that it _won't_ be run if the Ptr _is_ being referenced.
>>    
>>
>
>>From the GHC library documentation:
>
>    newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
>    [...] The only guarantee is that the finaliser runs before the program terminates.
>
>So it seems, finalization *is* guaranteed, just not promptness of finalization.
>  
>
This is not true - finalization is not guaranteed.

If you use a StablePtr it will not be garbage collected.

You really should not poll anything - it is wasteful of system resources.

    Keean.



More information about the Haskell-Cafe mailing list