Skip to content

Commit 2cecd89

Browse files
committed
Allow specifying time limit in environment variable
1 parent 3fb48d8 commit 2cecd89

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

mono/metadata/boehm-gc.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,18 @@ mono_gc_base_init (void)
230230
} else if (g_str_has_prefix (opt, "toggleref-test")) {
231231
register_test_toggleref_callback ();
232232
continue;
233-
} else if (g_str_has_prefix (opt, "incremental")) {
234-
GC_enable_incremental();
235-
#if HAVE_BDWGC_GC
236-
// value is in milliseconds
237-
GC_set_time_limit(3);
238-
#endif
233+
} else if (g_str_has_prefix (opt, "incremental=")) {
234+
size_t time_limit;
235+
236+
opt = strchr (opt, '=') + 1;
237+
if (*opt && mono_gc_parse_environment_string_extract_number (opt, &time_limit)) {
238+
GC_enable_incremental();
239+
#if HAVE_BDWGC_GC
240+
if (time_limit != 0)
241+
// value is in milliseconds
242+
GC_set_time_limit(time_limit);
243+
#endif
244+
}
239245
continue;
240246
} else {
241247
/* Could be a parameter for sgen */
@@ -257,11 +263,7 @@ mono_gc_base_init (void)
257263

258264
mono_thread_info_attach ();
259265

260-
//#ifdef HAVE_BDWGC_GC
261-
//GC_set_on_event (on_gc_notification);
262-
//#else
263266
GC_set_on_collection_event (on_gc_notification);
264-
//#endif
265267
GC_on_heap_resize = on_gc_heap_resize;
266268

267269
gc_initialized = TRUE;

0 commit comments

Comments
 (0)