[GHC] #15503: interpreter: sequence_ (replicate 100000000 (return ())) gobbles up memory

GHC ghc-devs at haskell.org
Fri Aug 10 20:48:25 UTC 2018


#15503: interpreter: sequence_ (replicate 100000000 (return ()))  gobbles up memory
-------------------------------------+-------------------------------------
           Reporter:  int-e          |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  low            |         Milestone:  8.6.1
          Component:  GHCi           |           Version:  8.4.3
           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:
-------------------------------------+-------------------------------------
 I consider this to be more of a curiosity than a bug, but it might still
 be worth investigating. The following line,
 {{{#!hs
 sequence_ (replicate 100000000 (return ()))
 }}}
 causes `ghci` to grow quite big (here it's 6GB on 64 bit Linux; it's
 roughly proportional to the `100000000` number).

 This used to be better in ancient times--before version 8.0.1, ghci ran
 this code in what looks like constant memory.

 (This came up indirectly on #haskell; somebody had adapted Hutton's game
 of life program, http://www.cs.nott.ac.uk/~gmh/life.lhs which uses busy
 waiting for a delay.)

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15503>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list