#5365: Finalizer running prematurely in ghci
---------------------------------+------------------------------------------
    Reporter:  ekmett            |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  GHCi                       
     Version:  7.0.3             |    Keywords:  finalizers                 
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------
 I have been building a library for doing hash consing, but it seemed to
 incorrectly finalize references to live entries in the hash cons table
 when I use it from ghci.

 I've distilled the problem to the following test case.

 {{{
 Prelude System.Mem.Weak GHC.IO> let x = let y = "foo" in (unsafePerformIO
 $ addFinalizer y (putStrLn "deleted")) `seq` y
 Prelude System.Mem.Weak GHC.IO> x
 "foo"
 deleted
 Prelude System.Mem.Weak GHC.IO> x
 "foo"
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5365>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to