Another finalizer question

Benjamin Franksen benjamin.franksen at bessy.de
Sun Nov 21 11:52:40 EST 2004


The library docs say

***
newForeignPtr :: ...

...Note that there is no guarantee on how soon the finalizer is executed after 
the last reference was dropped; this depends on the details of the Haskell 
storage manager. The only guarantee is that the finalizer runs before the 
program terminates.
***

As others have noted too, there is in fact *no* guarantee that finalizers are 
called. The only way I found to force calling of finalizers is explicitly 
calling System.Mem.performGC before the program exits.

Is this a bug in the implementation of finalizers or is the documentation 
wrong or am I just stupid?

Ben
-- 
Top level things with identity are evil.	-- Lennart Augustsson


More information about the Glasgow-haskell-users mailing list