
#9520: Running an action twice uses much more memory than running it once -------------------------------------+------------------------------------- Reporter: snoyberg | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: invalid | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Runtime | (amd64) performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #8457 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by edsko): * status: new => closed * resolution: => invalid Comment: Ok, I believe there is no ghc bug here, although admittedly these issues are incredibly subtle. The memory leak comes from the full laziness optimization, as @int-e points out. The interaction with -fprof-auto that I observed comes from interaction of cost centres with the state hack. And the difference between Michael's two examples turns out to be unimportant; if you split example one into two separate modules so that the optimizer gets less change to optimize the heck out of it, the memory behaviour of both examples is identical. I've written a long blog post that explores these issues in great detail; will publish soon. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9520#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler