Help me grok addFinalizer
Austin Seipp
mad.one at gmail.com
Thu Feb 16 21:55:13 CET 2012
64-bit GHC on OS X gives me this:
$ ghc -fforce-recomp -threaded finalizer
[1 of 1] Compiling Main ( finalizer.hs, finalizer.o )
Linking finalizer ...
$ ./finalizer
waiting ...
done!
waiting ...
running finalizer
done!
However, it's a different story when `-O2` is specified:
$ ghc -O2 -fforce-recomp -threaded finalizer
[1 of 1] Compiling Main ( finalizer.hs, finalizer.o )
Linking finalizer ...
$ ./finalizer
waiting ...
running finalizer
done!
waiting ...
done!
This smells like a bug. The stranger thing is that the GC will run the
finalizer, but it doesn't reclaim the object? I'd think `readIORef`
going after an invalidated pointer the GC reclaimed would almost
certainly crash.
On Thu, Feb 16, 2012 at 2:04 PM, Michael Craig <mkscrg at gmail.com> wrote:
> When I read the docs for System.Mem.Weak, it all seems to make sense. But
> then this code doesn't run as I expect it to when I turn on
> -threaded: http://hpaste.org/63832 (Expected/actual output are listed in the
> paste.)
>
> I've tried this on 7.4.1 and 7.0.4 with the same results. Can someone
> enlighten me?
>
> Cheers,
> Mike Craig
>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
--
Regards,
Austin
More information about the Glasgow-haskell-users
mailing list