[MLton] out of memory when compiling MLKit

Martin Elsman mael@itu.dk
Mon, 25 Apr 2005 15:48:13 +0200


Hi,

I have tried compiling the MLKit compiler using MLton
20041109. Unfortunately, compilation stops with an out-of-memory error
on our 4G (2G) RAM X86 machine. Below follows a dump of the
compilation messages together with some machine info. Does anyone know
of some options I can give to MLton to make it use less memory? The
MLton process dies when it reaches 2G virtual memory use.

Best Regards,

Martin Elsman

  mael@abacus Compiler $ ~/mlton-20041109/build/bin/mlton -verbose 2 bytecode.mlb
  MLton starting
  MLton 20041109 (built Mon Apr 25 14:15:16 2005 on abacus)
    created this file on Mon Apr 25 14:23:59 2005.
  Do not edit this file.
  Flag settings:
     align: 4
     atMLtons: (bytecode, @MLton, --)
     basis library: basis-2002
     log2 (card size): 8
     chunk: chunk per function
     codegen: Native
     contifyIntoMain: false
     debug: false
     deepFlattenDelay: true
     deepFlattenUnify: false
     defines: []
     diag passes: []
     drop passes: []
     elaborate allowConstant (default): false
     elaborate allowConstant (enabled): true
     elaborate allowExport (default): false
     elaborate allowExport (enabled): true
     elaborate allowImport (default): false
     elaborate allowImport (enabled): true
     elaborate allowPrim (default): false
     elaborate allowPrim (enabled): true
     elaborate allowOverload (default): false
     elaborate allowOverload (enabled): true
     elaborate allowRebindEquals (default): false
     elaborate allowRebindEquals (enabled): true
     elaborate deadCode (default): false
     elaborate deadCode (enabled): true
     elaborate forceUsed (default): 0
     elaborate forceUsed (enabled): true
     elaborate sequenceUnit (default): false
     elaborate sequenceUnit (enabled): true
     elaborate warnMatch (default): true
     elaborate warnMatch (enabled): true
     elaborate warnUnused (default): false
     elaborate warnUnused (enabled): true
     elaborate only: false
     eliminate overflow: true
     export header: None
     exn history: false
     gc check: Limit
     handlers: Flow
     indentation: 3
     inline: NonRecursive {product = 320, small = 60}
     inlineIntoMain: true
     input file: bytecode
     instrument: false
     instrument Sxml: false
     keep Machine: false
     keep RSSA: false
     keep SSA: false
     keep SSA2: false
     keep dot: false
     keep passes: []
     extra_: false
     lib dir: /home/mael/mlton-20041109/build/bin/../lib
     lib target dir: /home/mael/mlton-20041109/build/bin/../lib/self
     limit check: loop headers (fullCFG = false, loopExits = true)
     limit check counts: false
     loop passes: 1
     mark cards: true
     max function size: 10000
     may load world: true
     native commented: 0
     native live stack: false
     native optimize: 1
     native move hoist: true
     native copy prop: true
     native copy prop cutoff: 1000
     native cutoff: 100
     native live transfer: 8
     native future: 64
     native shuffle: true
     native ieee fp: false
     native split: Some 20000
     new return: false
     polyvariance: Some {rounds = 2, small = 30, product = 300}
     prof passes: []
     profile: None
     profile basis: false
     profile branch: false
     profile IL: ProfileSource
     profile stack: false
     reserve esp: None
     show basis: None
     show def-use: None
     show types: false
     ssaPassesSet: <ssaPassesSet>
     ssaPasses: [default]
     ssa2PassesSet: <ssa2PassesSet>
     ssa2Passes: [default]
     stack cont: false
     static: false
     sxmlPassesSet: <sxmlPassesSet>
     sxmlPasses: [default]
     target: self
     target arch: X86
     target OS: Linux
     type check: false
     type error: concise
     use basis library: true
     verbosity: Pass
     warn unrecognized annotation: true
     xmlPassesSet: <xmlPassesSet>
     xmlPasses: [default]
     zone cut depth: 100
     Compile SML starting
        pre codegen starting
           parseAndElaborate starting
           parseAndElaborate finished in 5.62 + 4.02 (42% GC)
           lex and parse totals 0.00 + 0.00 (0% GC)
           elaborate totals 5.62 + 4.02 (42% GC)
           deadCode starting
           deadCode finished in 0.06 + 0.00 (0% GC)
           defunctorize starting
  Warning: Regions/SpreadExpression.sml 1193.27.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Mus (:: ((_, _), (:: _)))), _)), _)
                     | (_, (TR (_, (Mus nil), _)), _)
                     | (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (_, E'.Mus [(tau1,   ...  se1, bind, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 399.11.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t0 as E'.TR (e', E'.Mus mus_0,   ...  ad (B, e0, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 1117.17.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t as E'.TR (e', E'.Mus mus0, _)  ...   S (B, e0, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 1100.17.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t as E'.TR (e', E'.Mus mus0, _)  ...   S (B, e0, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 1055.10.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, tr' as E'.TR (_, E'.Mus mus, ph  ...   S (B, e0, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 1028.32.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, tr' as E'.TR (_, E'.Mus mus', p  ...  = S (B, e, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 973.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   (B, arg1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 974.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t2 as E'.TR (e2', E'.Mus mus2,   ...   (B, arg2, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 953.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...  S (B, arg, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 942.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...  S (B, arg, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 921.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mu1',   ...  S (B, arg, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 874.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mu1',   ...  S (B, arg, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 860.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mu1',   ...  S (B, arg, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 823.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 800.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 801.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t2 as E'.TR (e2', E'.Mus mus2,   ...   S (B, e2, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 772.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 755.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 729.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mus1,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 730.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t2 as E'.TR (e2', E'.Mus mus2,   ...   S (B, e2, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 721.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t2 as E'.TR (e2', E'.Mus mus2,   ...   S (B, e1, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 602.16.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1, E'.Mus mus, ph  ...  (B, e1_ML, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 591.16.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1, E'.Mus mus, ph  ...  (B, e1_ML, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 579.10.
    Declaration is not exhaustive.
      missing pattern: (_,
                        (TR (_, (Mus (:: (((FUN (_, _, _)), _), (:: _)))), _)),
                        _)
                     | (_,
                        (TR (_,
                             (Mus (:: (((TYVAR _) | (CONSTYPE _) | (RECORD _), _),
                                       _))),
                             _)),
                        _)
                     | (_, (TR (_, (Mus nil), _)), _)
                     | (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1, E'.Mus [(R.FUN  ...  (B, e1_ML, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 580.17.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t2 as E'.TR (e2, E'.Mus mus2',   ...  (B, e2_ML, false, NOTAIL)
  Warning: Regions/SpreadExpression.sml 556.15.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, t1 as E'.TR (e1', E'.Mus mu_lis  ...   rse', body, false, TAIL)
  Warning: Regions/SpreadExpression.sml 538.23.
    Declaration is not exhaustive.
      missing pattern: (_, (TR (_, (Frame _) | RaisedExnBind, _)), _)
      in: (B, trip as E'.TR (e', E'.Mus mus1,  ...  S (B, exp, false, NOTAIL)
           defunctorize finished in 1.18 + 0.00 (0% GC)
           simplify Xml starting
              xmlShrink1 starting
              xmlShrink1 finished in 0.61 + 0.59 (49% GC)
              simplifyTypes starting
              simplifyTypes finished in 0.19 + 0.00 (0% GC)
           simplify Xml finished in 1.98 + 0.59 (23% GC)
           mono starting
           mono finished in 3.23 + 0.63 (16% GC)
           monoSimplify starting
              sxmlShrink1 starting
              sxmlShrink1 finished in 1.46 + 0.00 (0% GC)
              implementSuffix starting
              implementSuffix finished in 0.06 + 0.00 (0% GC)
              sxmlShrink2 starting
              sxmlShrink2 finished in 1.07 + 0.54 (34% GC)
              implementExceptions starting
              implementExceptions finished in 0.06 + 0.00 (0% GC)
              sxmlShrink3 starting
              sxmlShrink3 finished in 0.96 + 0.00 (0% GC)
              polyvariance starting
              polyvariance finished in 4.82 + 0.77 (14% GC)
           monoSimplify finished in 9.91 + 1.31 (12% GC)
           closureConvert starting
              flow analysis starting
              flow analysis finished in 1.28 + 0.00 (0% GC)
              free variables starting
              free variables finished in 0.22 + 0.00 (0% GC)
              globalize starting
              globalize finished in 0.15 + 0.00 (0% GC)
              convert starting
              convert finished in 3.35 + 2.99 (47% GC)
           closureConvert finished in 5.42 + 2.99 (36% GC)
           closureConvertSimplify starting
              checkScopes starting
              checkScopes finished in 2.00 + 4.41 (69% GC)
              removeUnused1 starting
              removeUnused1 finished in 2.83 + 1.90 (40% GC)
              leafInline starting
              leafInline finished in 1.33 + 0.97 (42% GC)
              contify1 starting
              contify1 finished in 1.33 + 0.88 (40% GC)
              localFlatten1 starting
              localFlatten1 finished in 1.11 + 1.39 (56% GC)
              constantPropagation starting
              constantPropagation finished in 5.30 + 15.76 (75% GC)
              useless starting
              useless finished in 9.61 + 16.48 (63% GC)
              removeUnused2 starting
              removeUnused2 finished in 2.30 + 2.56 (53% GC)
              simplifyTypes starting
              simplifyTypes finished in 5.18 + 1.12 (18% GC)
              polyEqual starting
              polyEqual finished in 0.67 + 0.52 (44% GC)
              contify2 starting
              contify2 finished in 1.34 + 2.95 (69% GC)
              inline starting
              inline finished in 1.57 + 1.43 (48% GC)
              localFlatten2 starting
              localFlatten2 finished in 1.25 + 0.33 (21% GC)
              removeUnused3 starting
              removeUnused3 finished in 2.70 + 2.62 (49% GC)
              contify3 starting
              contify3 finished in 1.61 + 1.36 (46% GC)
              introduceLoops starting
              introduceLoops finished in 0.03 + 0.00 (0% GC)
              loopInvariant starting
              loopInvariant finished in 1.20 + 0.88 (42% GC)
              localRef starting
              localRef finished in 1.43 + 2.54 (64% GC)
              flatten starting
              flatten finished in 2.61 + 6.64 (72% GC)
              localFlatten3 starting
              localFlatten3 finished in 1.52 + 0.66 (30% GC)
              commonArg starting
              commonArg finished in 4.28 + 12.32 (74% GC)
              commonSubexp starting
              commonSubexp finished in 2.39 + 2.11 (47% GC)
              commonBlock starting
              commonBlock finished in 0.87 + 3.51 (80% GC)
              redundantTests starting
              redundantTests finished in 2.15 + 1.54 (42% GC)
              redundant starting
              redundant finished in 2.65 + 3.94 (60% GC)
              knownCase starting
              knownCase finished in 6.19 + 5.94 (49% GC)
              removeUnused4 starting
              removeUnused4 finished in 3.04 + 2.56 (46% GC)
              checkScopes starting
              checkScopes finished in 1.85 + 0.41 (18% GC)
           closureConvertSimplify finished in 71.92 + 97.73 (58% GC)
           toSsa2 starting
           toSsa2 finished in 4.07 + 18.31 (82% GC)
           toSsa2Simplify starting
              checkScopes starting
              checkScopes finished in 3.17 + 8.37 (73% GC)
              deepFlatten starting
  08048000-0896d000 r-xp 00000000 08:0a 3313502    /home/mael/mlton-20041109/build/lib/mlton-compile
  0896d000-08b05000 rw-p 00925000 08:0a 3313502    /home/mael/mlton-20041109/build/lib/mlton-compile
  08b05000-08b2f000 rwxp 08b05000 00:00 0
  40000000-40015000 r-xp 00000000 08:05 390916     /lib/ld-2.3.4.so
  40015000-40017000 rw-p 00014000 08:05 390916     /lib/ld-2.3.4.so
  40017000-40018000 ---p 40017000 00:00 0
  40018000-4001c000 rw-p 40018000 00:00 0
  4001c000-4001d000 ---p 4001c000 00:00 0
  40020000-40021000 rw-p 40020000 00:00 0
  40021000-40041000 r-xp 00000000 08:05 1596273    /lib/libm-2.3.4.so
  40041000-40043000 rw-p 0001f000 08:05 1596273    /lib/libm-2.3.4.so
  40043000-4014b000 r-xp 00000000 08:05 390915     /lib/libc-2.3.4.so
  4014b000-4014c000 ---p 00108000 08:05 390915     /lib/libc-2.3.4.so
  4014c000-4014d000 r--p 00108000 08:05 390915     /lib/libc-2.3.4.so
  4014d000-40150000 rw-p 00109000 08:05 390915     /lib/libc-2.3.4.so
  40150000-beff6000 rw-p 40150000 00:00 0
  bf00d000-bffcb000 rw-p bf00d000 00:00 0
  bfffb000-c0000000 rwxp bfffb000 00:00 0
  ffffe000-fffff000 ---p 00000000 00:00 0
  Out of memory.

  mael@abacus Compiler $ cat /proc/meminfo
  MemTotal:      4151140 kB
  MemFree:       2097892 kB
  Buffers:         73500 kB
  Cached:          81856 kB
  SwapCached:         92 kB
  Active:        1110344 kB
  Inactive:       351636 kB
  HighTotal:     3276544 kB
  HighFree:      2014720 kB
  LowTotal:       874596 kB
  LowFree:         83172 kB
  SwapTotal:     3911816 kB
  SwapFree:      3911256 kB
  Dirty:               0 kB
  Writeback:           0 kB
  Mapped:           6756 kB
  Slab:           578784 kB
  Committed_AS:    14048 kB
  PageTables:        312 kB
  VmallocTotal:   114680 kB
  VmallocUsed:      2140 kB
  VmallocChunk:   112540 kB

  mael@abacus Compiler $ uname -a
  Linux abacus 2.6.7-hardened-r15 #1 SMP Fri Nov 26 09:47:32 CET 2004 i686 Intel(R) Xeon(TM) CPU 3.20GHz GenuineIntel GNU/Linux
  mael@abacus Compiler $