id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1752,CSE can create space leaks by increasing sharing,guest,,"The following program exhibits a space leak on GHC6.6.1.  ""noleak"" doesn't exhibit the leak.  The only difference is choosing to use $ (leaky) instead of () (non-leaky).

No leak happens if optimizations are off.

Compiled with {{{c:\haskell> ghc -O2 --make fibsquares.hs}}}

{{{
module Main where

fibs a b = a : fibs b (a+b)

odds (x:xs) = evens xs
evens (x:xs) = x : odds xs

square x = x*x
sumSucc xs = zipWith (+) xs (tail xs)

main = spaceleak

spaceleak = 
    mapM_ print $ zip [0..] $ takeWhile id $
    zipWith (==) (odds $ fibs 0 1) $ 
    sumSucc $ map square $ fibs 0 1

noleak =
    mapM_ print $ zip [0..] $ takeWhile id $
    zipWith (==) (odds $ fibs 0 1)
    (sumSucc $ map square $ fibs 0 1)
}}}
",bug,closed,low,_|_,Compiler,6.6.1,wontfix,,,Windows,Unknown/Multiple,Runtime performance bug,Unknown,,,,
