
16 Dec
2004
16 Dec
'04
9:52 a.m.
Udo Stenzel wrote:
Robert Dockins
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.