From: Vlad Brezae Date: Thu, 30 Mar 2017 21:01:16 +0000 (+0300) Subject: [sgen] Add debug option for valloc limit X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=fd5089b471e12d327d7ab12c3de6069d9e1a9573 [sgen] Add debug option for valloc limit This allows us to stress test OOM inside sgen (and potentially other areas). --- diff --git a/mono/sgen/sgen-gc.c b/mono/sgen/sgen-gc.c index fb6082ab6ab..f6aad7eeb37 100644 --- a/mono/sgen/sgen-gc.c +++ b/mono/sgen/sgen-gc.c @@ -193,6 +193,7 @@ #include "mono/utils/hazard-pointer.h" #include +#include #undef pthread_create #undef pthread_join @@ -3215,6 +3216,15 @@ sgen_gc_init (void) } else if (!strcmp (opt, "verify-before-allocs")) { verify_before_allocs = 1; has_per_allocation_action = TRUE; + } else if (g_str_has_prefix (opt, "max-valloc-size=")) { + size_t max_valloc_size; + char *arg = strchr (opt, '=') + 1; + if (*opt && mono_gc_parse_environment_string_extract_number (arg, &max_valloc_size)) { + mono_valloc_set_limit (max_valloc_size); + } else { + sgen_env_var_error (MONO_GC_DEBUG_NAME, NULL, "`max-valloc-size` must be an integer."); + } + continue; } else if (g_str_has_prefix (opt, "verify-before-allocs=")) { char *arg = strchr (opt, '=') + 1; verify_before_allocs = atoi (arg); @@ -3295,6 +3305,7 @@ sgen_gc_init (void) fprintf (stderr, "Valid