[GHC] #16011: GHCi leaks memory even with -fno-it.

GHC ghc-devs at haskell.org
Sat Dec 8 10:22:50 UTC 2018


#16011: GHCi leaks memory even with -fno-it.
-------------------------------------+-------------------------------------
           Reporter:  AndreasK       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.3
          Component:  GHCi           |           Version:  8.7
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 GHCi leaks are not exactly new, but this one is especially easy to
 trigger/reproduce.

 The memory allocated by f never gets freed.
 {{{
 PS E:\binary-perf> ..\ghc-8.6.1\bin\ghci.exe -fno-it
 GHCi, version 8.6.1: http://www.haskell.org/ghc/  :? for help
 Prelude> f = [1 .. 20000000] :: [Int]
 Prelude> length f
 20000000
 Prelude> f = [1 .. 20000001] :: [Int]
 Prelude> length f
 20000001
 Prelude> f = [1 .. 20000002] :: [Int]
 Prelude> length f
 20000002
 Prelude> f = [1 .. 20000000] :: [Int]
 Prelude> length f
 20000000
 Prelude>
 }}}

 Or using head and even simpler:

 {{{
 PS E:\binary-perf> ..\ghc_commonAsm\inplace\bin\ghci.exe -fno-it
 GHCi, version 8.7.20181207: http://www.haskell.org/ghc/  :? for help
 Loaded package environment from E:\binary-
 perf\.ghc.environment.x86_64-mingw32-8.7.20181207
 Prelude> f = replicate 2000000 False
 Prelude> length f
 2000000
 Prelude> f = replicate 2000000 False
 Prelude> length f
 2000000
 Prelude> f = replicate 2000000 False
 Prelude> length f
 2000000
 Prelude> f = replicate 2000000 False
 Prelude> length f
 }}}

 GHC just keeps using more and more memory when I repeat this.

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


More information about the ghc-tickets mailing list