Ticket #2762 (new bug)
Excessive heap usage
| Reported by: | igloo | Owned by: | |
|---|---|---|---|
| Component: | Compiler | Version: | 6.11 |
| Keywords: | Cc: | batterseapower@… | |
| Operating System: | Unknown/Multiple | ||
| Test Case: | Architecture: | Unknown/Multiple | |
| Type of failure: |
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.

