Bug 22840 - Mono Boehm GC is limited to allocating 64GB
Summary: Mono Boehm GC is limited to allocating 64GB
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: 3.4.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-10 13:43 UTC by Craig Minihan
Modified: 2014-10-03 09:36 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Craig Minihan 2014-09-10 13:43:15 UTC
In libgc/include/private/gc_priv.h there is the following define:

# ifdef LARGE_CONFIG
#   if CPP_WORDSZ > 32
#     define MAX_HEAP_SECTS 4096 	/* overflows at roughly 64 GB	   */ <=== here is the problem!
#   else
#     define MAX_HEAP_SECTS 768		/* Separately added heap sections. */
#   endif
# else
#   ifdef SMALL_CONFIG
#     define MAX_HEAP_SECTS 128		/* Roughly 256MB (128*2048*1K)	*/
#   else
#     define MAX_HEAP_SECTS (384+128)		/* Roughly 4GB			*/
#   endif
# endif

My application uses more than 64GB so I hit this case in libgc/alloc.c: 
if (GC_n_heap_sects >= MAX_HEAP_SECTS) {
    ABORT("Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS");

I build from source so I can change this define value. However it would be nice to increase this limit for binary installs of Mono too.

A new limit of 1TB or higher would be great.
Comment 1 Craig Minihan 2014-09-11 06:28:09 UTC
I updated MAX_HEAP_SECTS to 16384 locally and have my Mono process (3.4) running quite happily now with 150GB allocated.
Comment 2 Craig Minihan 2014-09-26 05:37:17 UTC
This issue is for Boehm only - not sgen.

On CentOS sgen required the following setting change:
$ sysctl vm.max_map_count=655360

The default value of 65530 doesn't work above ~30GB or so.
Comment 3 Rodrigo Kumpera 2014-10-03 08:26:48 UTC
We have no plans to change Boehm any further.
Comment 4 Craig Minihan 2014-10-03 09:36:09 UTC
That's a shame since 64GB+ servers can be rented for ~$100 a month - not exactly a high end configuration. Boehm also seems more stable than sgen at v high memory load.