
Quoting Antoine Latter
On Thu, Feb 16, 2012 at 2:04 PM, Michael Craig
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?
First off, I'm pretty sure finalizers won't run until the data they were associated with has been GCd, and GHC doesn't do GCs unless there is allocation - threadDelay doesn't allocate much, I imagine.
This seems to be an explanation of why a finalizer might run later than expected (or not run at all). But his paste shows that it runs *earlier* than what he expected. ~d