
#7954: Strictness analysis regression ------------------------------------+--------------------------------------- Reporter: chad.scherrer | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: x86_64 (amd64) Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- The sum function from the Prelude relies on GHC's strictness analysis. Here's a run on GHC 7.6.2 where I kill it partway through - max resident memory is over 6 GB. Everything works perfectly if I replace `sum` with `foldl' (+) 0.0`. Chris Done also tested this on 7.4.2; in that case the memory leak is not present and the code runs fine. {{{ --------------------------- chad@chad-desktop:~$ cat norm.hs norm :: [Double] -> Double norm = sqrt . sum . map (\x -> x*x) main :: IO () main = print . norm $ enumFromTo 0 100000000 --------------------------- chad@chad-desktop:~$ ghc -V The Glorious Glasgow Haskell Compilation System, version 7.6.2 --------------------------- chad@chad-desktop:~$ ghc -O2 norm.hs [1 of 1] Compiling Main ( norm.hs, norm.o ) Linking norm ... --------------------------- chad@chad-desktop:~$ /usr/bin/time ./norm ^CCommand terminated by signal 2 21.68user 2.72system 0:24.51elapsed 99%CPU (0avgtext+0avgdata 6370516maxresident)k 0inputs+0outputs (0major+1592762minor)pagefaults 0swaps --------------------------- }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7954 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler