Mono: Too many heap sections Increase MAXHINCR or MAX_HEAP_SECTS when an application takes up more than 4 GB of memory

I run my mono application on bitnami linux with 8 GB of memory. This is a complex file merging application that is supposed to take up a lot of RAM. But every time when more than 4 GB of RAM is required, it comes out with the following error message:

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) <0x0005e> at (wrapper managed-to-native) object.__icall_wrapper_mono_array_new_specific (intptr,int) <0x0005e> at System.Collections.Generic.Dictionary`2<string, System.Nullable`1<int>>.InitArrays (int) <0x00040> at System.Collections.Generic.Dictionary`2<string, System.Nullable`1<int>>.Init (int,System.Collections.Generic.IEqualityComparer`1<string>) <0x00091> at System.Collections.Generic.Dictionary`2<string, System.Nullable`1<int>>..ctor () <0x0001b> at lawyerGatherBot.Merger.LawyerRepresentation..ctor (string) <0x00080> at lawyerGatherBot.Merger.MergeLawyerRecords.Map (System.Collections.Generic.IEnumerable`1<string>) <0x00167> at lawyerGatherBot.Program.Main (string[]) <0x00161> at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0x00082> 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 

Here's the output of mono -V:

 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) 

What to do to run applications with intensive memory on mono?

* UPDATE I messed up and compiled the application for 32-bit systems. Hence this error.

+4
source share
2 answers

I understand that this error is related to GC Boehm.

Try it first. Download and create the source code using the script below. In the script configuration part, make this change:

./configure --with-large-heap = yes

Do this in addition to any other configuration problems you want to install. This should set the flag LARGE_CONFIG.

If you want to install it manually (I donโ€™t know why), follow these steps:

  • Download the mono source and run the script here

http://www.integratedwebsystems.com/2011/08/install-mono-2-10-3-on-ubuntu-using-bash-script/

  • Now go back and add the following code to the beginning

builds / mono-2.10.8 / libgc / include / gc_config_macros.h

 #ifndef LARGE_CONFIG #define LARGE_CONFIG #endif 
  • Now go to build / mono-2.10.8 and run

makeup sudo make install

Hope this compiles a new mono that solves your problem. The resulting mono will be in / opt

Some of the most affected codes are in the libgc / include / private / gc_priv.h file, but developers make good use of the conventions for the LARGE_CONFIG flag, so working with this is best.

+2
source

Use mono 2.10.2 or later (possibly with a new GC with the option --gc = sgen). Your mono version is very old.

+2
source

All Articles