addForeignPtrFinalizer - finalizers run in FIFO or LIFO order?

Henning Thielemann lemming at henning-thielemann.de
Sat Aug 18 18:10:14 CEST 2012


Hi Bertram,


On Sat, 18 Aug 2012, Bertram Felgenhauer wrote:

> Henning Thielemann wrote:
>> and let the finalizers print something when they are started.
>> I get the output:
>>
>>   finalizer1
>>   finalizer2
>
> Funny bug, I can reproduce it. (And it is a bug; the code in question
> violates a documented invariant.) What happens is, in essence, that the
> list of finalizers is reversed during garbage collection.
>
> See http://hackage.haskell.org/trac/ghc/ticket/7160 for an example
> program.

Thank you a lot for working out the example! It could have required ages 
for me to reduce my problem to such a compact example.



More information about the Libraries mailing list