Ticket #1752 (closed bug: wontfix)
CSE can create space leaks by increasing sharing
| Reported by: | guest | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler | Version: | 6.6.1 |
| Keywords: | Cc: | ||
| Operating System: | Windows | Architecture: | Unknown/Multiple |
| Type of failure: | Runtime performance bug | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
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)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

