[GHC] #14272: GHC goes out of memory while compiling simple program with optimizations

GHC ghc-devs at haskell.org
Sat Sep 23 07:04:09 UTC 2017


#14272: GHC goes out of memory while compiling simple program with optimizations
-------------------------------------+-------------------------------------
        Reporter:  39aldo39          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 It seems to me that this may not be caused by allocation but maybe some
 code generation bug. I tried this:

 {{{
 $ ghc-stage2 main.hs -O -fforce-recomp -ddump-ds -ddump-simpl -ddump-stg
 -ddump-to-file -dsuppress-all +RTS -M10000
 ghc-stage2: maximum heap size (-M) is smaller than minimum alloc area size
 (-A)
 ghc-stage2: internal error: getTopHandlerThread: neither a WEAK nor a
 DEAD_WEAK: 0x7f9baeaa7fd8 0x7f9bae621270 -1991765780
     (GHC version 8.3.20170914 for x86_64_unknown_linux)
     Please report this as a GHC bug:
 http://www.haskell.org/ghc/reportabug
 [1]    30799 abort      ghc-stage2 main.hs -O -fforce-recomp -ddump-ds
 -ddump-simpl -ddump-stg   +RTS

 $ ghc-stage2 main.hs -O -fforce-recomp -ddump-ds -ddump-simpl -ddump-stg
 -ddump-to-file -dsuppress-all +RTS -M100000
 ghc-stage2: maximum heap size (-M) is smaller than minimum alloc area size
 (-A)
 reportHeapOverflow
 ghc-stage2: Heap exhausted;
 ghc-stage2: Current maximum heap size is 98304 bytes (0 MB).
 ghc-stage2: Use `+RTS -M<size>' to increase it.

 $ ghc-stage2 main.hs -O -fforce-recomp -ddump-ds -ddump-simpl -ddump-stg
 -ddump-to-file -dsuppress-all +RTS -M1000000
 ghc-stage2: maximum heap size (-M) is smaller than minimum alloc area size
 (-A)
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.3.20170914 for x86_64-unknown-linux):
         heap overflow
 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

 When I run without any RSTS parameters the error is triggered by
 `Storage.c:allocate` with these parameters:

 {{{
 RtsFlags.GcFlags.maxHeapSize = 0
 req_blocks = 1
 LARGE_OBJECT_THRESHOLD: 3276
 n: 2
 }}}

 I don't know if `maxHeapSize = 0` is normal.

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


More information about the ghc-tickets mailing list