
#13080: Constant values are not floated out of the loop -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: 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 dfeuer): The original program leaks memory even without optimization. In this case, the trouble is that {{{#!hs poll () = return () >> return () >> ... }}} `forever` always holds on to its argument, which prevents any part of `poll ()` from being collected as it's run. You can fix this (with or without optimization) by defining {{{#!hs poll _ = fix (return () >>) }}} which makes `poll ()` finite in size. While you and I both know that `forever` doesn't need to hold on to `poll ()` in this case, I don't see how GHC can be expected to see that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13080#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler