title: Mono: Too many heap sections Increase MAXHINCR or MAX_HEAP_SECTS when app takes more than 4 GB in memory
body: <p>I am running my mono application at a bitnami linux with 8 GB of memory. It is a sophisticated file merger application, which is supposed to take a lot of RAM as it works.
  But every time it takes more than 4 GB of RAM, it crashes with following error message:</p>
  
  <pre><code>Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS
  Stacktrace:
  
    at (wrapper managed-to-native) object.__icall_wrapper_mono_array_new_specific (intptr,int) &lt;0x0005e&gt;
    at (wrapper managed-to-native) object.__icall_wrapper_mono_array_new_specific (intptr,int) &lt;0x0005e&gt;
    at System.Collections.Generic.Dictionary`2&lt;string, System.Nullable`1&lt;int&gt;&gt;.InitArrays (int) &lt;0x00040&gt;
    at System.Collections.Generic.Dictionary`2&lt;string, System.Nullable`1&lt;int&gt;&gt;.Init (int,System.Collections.Generic.IEqualityComparer`1&lt;string&gt;) &lt;0x00091&gt;
    at System.Collections.Generic.Dictionary`2&lt;string, System.Nullable`1&lt;int&gt;&gt;..ctor () &lt;0x0001b&gt;
    at lawyerGatherBot.Merger.LawyerRepresentation..ctor (string) &lt;0x00080&gt;
    at lawyerGatherBot.Merger.MergeLawyerRecords.Map (System.Collections.Generic.IEnumerable`1&lt;string&gt;) &lt;0x00167&gt;
    at lawyerGatherBot.Program.Main (string[]) &lt;0x00161&gt;
    at (wrapper runtime-invoke) &lt;Module&gt;.runtime_invoke_void_object (object,intptr,intptr,intptr) &lt;0x00082&gt;
  
  Native stacktrace:
  
      mono() [0x48bd6b]
      /lib/libpthread.so.0(+0xf8f0) [0x7f6c4198a8f0]
      /lib/libc.so.6(gsignal+0x35) [0x7f6c4162ba75]
      /lib/libc.so.6(abort+0x180) [0x7f6c4162f5c0]
      mono() [0x5da188]
      mono() [0x5d7ec0]
      mono() [0x5d8349]
      mono() [0x5d8534]
      mono() [0x5d86f1]
      mono() [0x5d3571]
      mono() [0x5d4752]
      mono() [0x5d50e5]
      mono(mono_array_new_specific+0xba) [0x53716a]
      [0x40df9f2f]
  
  Debug info from gdb:
  
  
  =================================================================
  Got a SIGABRT while executing native code. This usually indicates
  a fatal error in the mono runtime or one of the native libraries
  used by your application.
  =================================================================
  
  Aborted
  </code></pre>
  
  <p>Here's the output of mono -V :</p>
  
  <pre><code>Mono JIT compiler version 2.8.2 (tarball Tue Aug 30 18:06:04 UTC 2011)
  Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
      TLS:           __thread
      SIGSEGV:       altstack
      Notifications: epoll
      Architecture:  amd64
      Disabled:      none
      Misc:          debugger softdebug
      LLVM:          supported, not enabled.
      GC:            Included Boehm (with typed GC and Parallel Mark)
  </code></pre>
  
  <p>What should I do to be able to run memory-intensive apps on mono?</p>
  
  <p>*UPDATE
  I screw up and compiled the app for 32 bit systems. Hence, this error. </p>