[GHC] #5205: Control.Monad.forever leaks space
GHC
cvs-ghc at haskell.org
Mon Aug 20 23:28:58 CEST 2012
#5205: Control.Monad.forever leaks space
--------------------------------------+-------------------------------------
Reporter: akio | Owner: pcapriotti
Type: bug | Status: merge
Priority: high | Milestone: 7.6.1
Component: libraries/base | Version: 7.0.3
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Runtime performance bug | Difficulty: Unknown
Testcase: T5205 | Blockedby:
Blocking: | Related:
--------------------------------------+-------------------------------------
Changes (by pcapriotti):
* status: new => merge
Comment:
Pushed:
{{{
commit f55f5574c12ff8dfe57994219eee0702ac8aba2e
Author: Paolo Capriotti <p.capriotti at gmail.com>
Date: Mon Aug 20 16:35:38 2012 +0100
Improve definition of forever (#5205)
The previous implementation was:
forever a = a >> forever a
which can create a space leak in some cases, even with optimizations.
The current implementation:
forever a = let a' = a >> a' in a'
prevents repeated thunk allocations by creating a single thunk for the
final result, even without optimizations.
}}}
I also removed the note and a `SPECIALISE` pragma in GHC.ST.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5205#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list