Bug 14626 - Error: Garbage collector could not allocate 524288 bytes of memory for major heap section.
Summary: Error: Garbage collector could not allocate 524288 bytes of memory for major ...
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-10 22:34 UTC by hui
Modified: 2017-07-07 21:07 UTC (History)
5 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_REPRODUCIBLE

Description hui 2013-09-10 22:34:53 UTC
My program has been terminated, the exception information is "Error: Garbage collector could not allocate 524288 bytes of memory for major heap section".

Can I modify the source code?

souce:/ metadata / sgen-memory-governor.c

void
sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description)
{
	if (ptr || !assert_description)
		return;
	fprintf (stderr, "Error: Garbage collector could not allocate %zu bytes of memory for %s.\n", requested_size, assert_description);
	// exit (1); 
}

I want to get more detailed information about how to do it?

Mono JIT compiler version 3.0.6
OS: CentOs 6.3
Comment 1 hui 2013-09-10 22:46:37 UTC
I am hoping to get the OutOfMemoryException, how to do it?
Comment 2 Zoltan Varga 2013-09-11 05:44:17 UTC
Our OutOfMemoryException generation is not very good, we usually assert instead of throwing it.
Comment 3 hui 2013-09-11 06:03:47 UTC
I see.
Comment 4 Rodrigo Kumpera 2013-09-12 10:36:36 UTC
You can force a heap size limit so you can get a nicer OOM exception. See mono's man page for further information.
Comment 5 hui 2013-09-13 03:49:53 UTC
ok,thanks.
Comment 6 hui 2013-09-22 06:29:38 UTC
Hi,
I Tied
export MONO_GC_PARAMS="major=marksweep-fixed,major-heap-size=2g"

How do I know the modified configuration has been successful?
Comment 7 Rodrigo Kumpera 2013-09-22 20:36:41 UTC
Enable GC logging by passing MONO_LOG_LEVEL=debug.

What you did is not set a max heap size, but use the fixed heap collector. You should use the max-heap-size option instead.
Comment 8 hui 2013-09-23 02:48:28 UTC
Ah, I did not find this parameter in the mono's man page.

I set "max-heap-size" to how much?


PC-Memory is 8G.
Comment 9 Rodrigo Kumpera 2014-01-17 14:51:57 UTC
Se to how much you think your app need. You can use k, m and g suffixes when specifying sizes.
Comment 10 Ludovic Henry 2017-07-07 21:07:31 UTC
Can you still reproduce this bug with latest version of mono? Please feel free to reopen if that is still the case. Thank you.