[GHC] #12205: Program develops space leak with -fprof-auto
GHC
ghc-devs at haskell.org
Sun Jun 19 04:11:51 UTC 2016
#12205: Program develops space leak with -fprof-auto
-------------------------------------+-------------------------------------
Reporter: kristenk | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Profiling | Version: 7.4.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This program seems to use constant memory when compiled with only `-prof`,
but it uses increasing amounts of memory when compiled with `-prof` and
`-fprof-auto`. I observed the behavior with GHC 8.0.1, 7.10.3, 7.8.4,
7.6.3, and 7.4.2, but not 7.0.4 (with `-auto-all`).
{{{#!hs
import System.Environment
main :: IO ()
main = do
n <- (read . head) `fmap` getArgs
case f [0..(n::Int)] 0 of
(xs, s) -> print xs >> print s
f :: [Int] -> Int -> ([Int], Int)
f [] s = ([], s)
f (x:xs) s =
let (xs', s') = f xs (x + s)
in (x + s : xs', s')
}}}
{{{
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.1
$ ghc Main.hs -prof
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ /run/current-system/sw/bin/time ./Main 5000000 > /dev/null
2.80user 0.01system 0:02.82elapsed 100%CPU (0avgtext+0avgdata
6028maxresident)k
0inputs+0outputs (0major+661minor)pagefaults 0swaps
}}}
{{{
$ ghc Main.hs -prof -fprof-auto
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
$ /run/current-system/sw/bin/time ./Main 5000000 > /dev/null
4.03user 0.35system 0:04.38elapsed 100%CPU (0avgtext+0avgdata
1574348maxresident)k
0inputs+0outputs (0major+392857minor)pagefaults 0swaps
}}}
[[Image(no-fprof-auto.png)]]
[[Image(fprof-auto.png)]]
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12205>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list