Ticket #2762 (closed bug: fixed)
Excessive heap usage
| Reported by: | igloo | Owned by: | igloo |
|---|---|---|---|
| Priority: | low | Milestone: | 7.2.1 |
| Component: | Compiler | Version: | 6.11 |
| Keywords: | Cc: | batterseapower@…, michal.terepeta@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Compile-time performance bug | Difficulty: | Unknown |
| Test Case: | T2762 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
With Main.hs:
module Main (main) where
import InputOutput
main :: IO ()
main = do
let content1 = concat (replicate 1000000 "1x") ++ "0"
let i1 = fst $ input content1
view i1
let content2 = concat (replicate 1000001 "1y") ++ "0"
let i2 = fst $ input content2
view i2
view :: [Char] -> IO ()
view [] = return ()
view (i : is) = i `seq` view is
and InputOutput.hs:
module InputOutput (input) where
class InputOutput a where
input :: String -> (a, String)
instance InputOutput Char where
input (x : bs) = (x, bs)
instance InputOutput a => InputOutput [a] where
input ('0':bs) = ([], bs)
input ('1':bs) = case input bs of
(x, bs') ->
case input bs' of
~(xs, bs'') -> (x : xs, bs'')
according to
ghc -O -prof -auto-all --make Main.hs -fforce-recomp ./Main +RTS -h
heap usage goes up to about 20M with the HEAD, but only about 200 bytes with 6.8.2.
This is with 6.11.20081108, but I started investigating with the HEAD when I saw similar problems with more-or-less 6.10.1.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

