
#13080: Memory leak caused by nested monadic loops -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.8.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 saurabhnanda): I ''think'' I have been hit by this bug. Is the following going to leak memory due to this bug: {{{ worker :: (AppMonad m) => TChan MyType -> m () worker chan = do mItem <- tryReadTChanIO chan case mItem of Just item -> do processItem item worker chan Nothing -> pure () }}} Can it be fixed by using {{{whileJust_}}} from http://hackage.haskell.org/package/monad-loops-0.4.3/docs/src/Control- Monad-Loops.html#whileJust_ ? {{{ worker :: (AppMonad m) => TChan MyType -> m () worker chan = whileJust_ (tryReadTChanIO chan) processItem }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13080#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler