Help me grok addFinalizer

2012-02-16 Thread Michael Craig
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

Re: Help me grok addFinalizer

2012-02-16 Thread Michael Craig
reclaimed would almost certainly crash. On Thu, Feb 16, 2012 at 2:04 PM, Michael Craig mks...@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

Re: Help me grok addFinalizer

2012-02-16 Thread Michael Craig
I haven't checked, but ... I checked, and your solution works. In the context of a larger program, getting NOLINE pragmas in all the right places would be challenging, wouldn't it? I found a bug report on the GHC Trac [1] in which Simon explains the importance of evaluating the thunk before