
#12996: Memory leak in recursion when switching from -O1 to -O2 -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Memory leak, | optimization Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): This turns out to be an example of #11731. It turns out that the thunk for `cycleState state` is wrongly marked "used-once", and that's why there's a massive slow-down. (Each iteration evaluates it twice, so it goes exponential.) The patch for #11731 fixes it, but it never made it into GHC 8.0. I'll mark it thus in case we ship 8.0.3. It really is quite a serious bug. I'll make this bug into a test case. Meanwhile:
Demand analyzer thinks appLoop is not strict on s.
It looks strict, but the demand analyser has a hack for I/O: earlier operations migth throw an exception, and so we treat them as lazy in their continuation. See `Note [IO hack in the demand analyser]` in `DmdAnal`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12996#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler