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

GHC ghc-devs at haskell.org
Wed Sep 19 12:08:36 UTC 2018


#15503: interpreter: sequence_ (replicate 100000000 (return ()))  gobbles up memory
-------------------------------------+-------------------------------------
        Reporter:  int-e             |                Owner:  osa1
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.8.1
       Component:  GHCi              |              Version:  8.5
      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 osa1):

 Simon, do you have any guesses on what may be retaining those PAPs?

 Btw, here's the Core generated for this expression: (output of -ddump-
 simpl)

 {{{
 GHC.Base.bindIO
   @ ()
   @ [()]
   (GHC.GHCi.ghciStepIO
      @ GHC.Types.IO
      GHC.GHCi.$fGHCiSandboxIOIO
      @ ()
      (Data.Foldable.sequence_
         @ []
         @ GHC.Types.IO
         @ ()
         Data.Foldable.$fFoldable[]
         GHC.Base.$fMonadIO
         (GHC.List.replicate
            @ (GHC.Types.IO ())
            (GHC.Types.I# 100000000#)
            (GHC.Base.return
               @ GHC.Types.IO GHC.Base.$fMonadIO @ () GHC.Tuple.()))))
   (\ (it_a1UK :: ()) ->
      GHC.Base.returnIO
        @ [()] (GHC.Types.: @ () it_a1UK (GHC.Types.[] @ ())))
 }}}

 More readable version:

 {{{
 GHC.Base.bindIO
     (ghciStepIO <the expression>)
     (\i -> GHC.Base.returnIO [i])
 }}}

 The Core identical to the Core generated by GHC 7.10.

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


More information about the ghc-tickets mailing list