[GHC] #5205: Control.Monad.forever leaks space

GHC cvs-ghc at haskell.org
Thu Aug 16 14:56:47 CEST 2012


#5205: Control.Monad.forever leaks space
--------------------------------------+-------------------------------------
  Reporter:  akio                     |          Owner:                  
      Type:  bug                      |         Status:  new             
  Priority:  normal                   |      Milestone:  7.2.1           
 Component:  libraries/base           |        Version:  7.0.3           
Resolution:                           |       Keywords:                  
        Os:  Unknown/Multiple         |   Architecture:  Unknown/Multiple
   Failure:  Runtime performance bug  |     Difficulty:                  
  Testcase:                           |      Blockedby:                  
  Blocking:                           |        Related:                  
--------------------------------------+-------------------------------------
Changes (by edsko):

  * owner:  igloo =>
  * status:  closed => new
  * resolution:  fixed =>


Comment:

 I have an example with a space leak (according to "+RTS -hy") due to
 "forever" when compiled with "-prof -fauto-all -O1" and when compiled with
 "-prof -fprof-auto -O2", but not when compiled with "-prof -fprof-auto
 -O0" for some bizarre reason. When I remove the "-prof -fprof-auto" and
 profile with "+RTS -hT" the space leak disappears for any optimization
 level.

 I have tried to minimize the example but failed so far, unfortunately.
 However, the following alternative definition of "forever" doesn't have a
 space leak with any compiler flags:

 {{{
 forever a = let a' = a >> a' in a'
 }}}

 Is there a good reason why this definition is not used? It seems less
 reliant on optimization to avoid the space leak.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5205#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list