[Haskell-cafe] GHC, odd concurrency space leak

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Apr 15 04:55:14 EDT 2010


Hello Neil,

Thursday, April 15, 2010, 12:37:35 PM, you wrote:

> I find non-termination with a much simpler program than yours (GHC 6.12.1):
>    forkIO $ do putStrLn "Started thread"
>                forever $ return ()

ghc multithreading is actually cooperative: it switches only on memory
allocation. since almost any haskell code allocates, there is no
problem - it works like preemptive one. but sometimes this assumption
fails - with optimization enabled, your code doesn't allocate so there
are no chances for thread switching. replacing return () with
threadDelay call solves the problem


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list