#4018: Concurrency space leak
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  high              |   Milestone:  7.4.1                  
   Component:  Compiler          |     Version:  6.12.2                 
    Keywords:                    |          Os:  Unknown/Multiple       
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
  Difficulty:  Unknown           |    Testcase:                         
   Blockedby:                    |    Blocking:                         
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * priority:  normal => high
  * difficulty:  => Unknown
  * failure:  None/Unknown => Runtime performance bug


Comment:

 This seems to be fixed since 7.0.  I presume it is arity analysis allowing
 the definition of `forever` to be eta-expanded.  For reference here is the
 code, compile with 6.12.x and `-O -fno-state-hack` to illustrate the leak:

 {{{
 module Main (main) where

 import Control.Concurrent
 {-
 always :: Monad m => m a -> m b
 always a = a >> always a
 -}
 always :: Monad m => m a -> m b
 always a = do
     _ <- a
     always a

 spawner :: IO ()
 spawner = always $ do
     forkIO $ always (return ())
     putStrLn "Delaying"
     threadDelay 1000000

 main :: IO ()
 main = do
     putStrLn "Spawning"
     forkIO spawner
     putStrLn "Delaying main"
     threadDelay 4000000
 }}}

 We should add this as a test and close.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to