addForeignPtrFinalizer - finalizers run in FIFO or LIFO order?

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat Aug 18 17:43:38 CEST 2012


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.

Best regards,

Bertram



More information about the Libraries mailing list