Memory use blowup with -O1 (versus -O0) in GHC 6.12.1/6.12.2
robgreayer at gmail.com
Mon May 10 13:33:00 EDT 2010
I've encountered an interesting issue with GHC 6.12.1 and 2 in which a
small program compiles quickly without using loads of memory with
optimization turned off, but with optimization (-O1) turned on, GHC's
memory usage becomes very high (and compilation takes much much
$ time ghc -c -O0 Tst.hs
$ time ghc -c -O1 Tst.hs
Memory used by GHC looks like it tops out at 3G (in the -O1 case).
Constraining the heap size to 1G causes compilation to fail:
$ ghc +RTS -M1g -RTS -c -O1 Tst.hs
Current maximum heap size is 1073741824 bytes (1024 MB);
use `+RTS -M<size>' to increase it.
(whereas, without optimization, a heap of 16m is sufficient)
The module being compiled is (probably deceptively) simple:
module Tst where
data Rec1 = Rec1 !Int
mkRec1 v = mk $ merge v () where mk (Tagged i :* ()) = Rec1 i
but the devil is in the details of 'merge' (attached) which merges
heterogeneous lists of values, using a lot of type level programming
with type families. Does this sound like an known, open issue? I was
unable to find anything in GHC Trac that looked similar.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4179 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20100510/1e3c506a/Merge.obj
More information about the Glasgow-haskell-users