[Haskell-cafe] Re: FPS: Finalizers not running (was Memory usage outside of the Haskell heap)

Joel Reymont joelr1 at gmail.com
Sun Nov 6 13:37:43 EST 2005


You need to do something like this to force them to run, apparently

main = do foo $ Prelude.concat $ replicate 100 data_

Just triggering the GC with performGC doesn't do it.

The really odd thing is that if I setup a C finalizer (see below)  
then it's triggered once and the whole thing crashes with a bus  
error. Duncan reported that it segfaulted for him as well.

installFinalizer fps@(P.PS fp _ _) =
     addForeignPtrFinalizer finalizer fp

foreign import ccall unsafe "finalizer" finalizer :: FinalizerPtr Word8

where the finalizer itself is

#include <stdio.h>

void finalizer(char *p) {
         printf("--- Finalized: %x\n", p);
}

On Nov 6, 2005, at 6:31 PM, David Roundy wrote:

> This is definitely odd.  I can't see a reason why the finalizers  
> wouldn't
> be running.

--
http://wagerlabs.com/







More information about the Haskell-Cafe mailing list