X-Git-Url: https://git.llucax.com/software/dgc/cdgc.git/blobdiff_plain/7b736090719c6f08e286b246d9b7509413716fcf..68f7d87cf5eae6f656e43bb8472b555755a9cef4:/rt/gc/cdgc/opts.d?ds=sidebyside diff --git a/rt/gc/cdgc/opts.d b/rt/gc/cdgc/opts.d index 7cd6784..01ac964 100644 --- a/rt/gc/cdgc/opts.d +++ b/rt/gc/cdgc/opts.d @@ -55,9 +55,13 @@ struct Options char[MAX_OPT_LEN] collect_stats_file = ""; bool sentinel = false; bool mem_stomp = false; - bool conservative = false; + version (D_HavePointerMap) + bool conservative = false; + else + bool conservative = true; bool fork = true; bool eager_alloc = true; + bool early_collect = false; uint min_free = 5; // percent of the heap (0-100) size_t prealloc_psize = 0; size_t prealloc_npools = 0; @@ -151,6 +155,8 @@ void process_option(char* opt_name, char* opt_value) options.fork = parse_bool(opt_value); else if (cstr_eq(opt_name, "eager_alloc")) options.eager_alloc = parse_bool(opt_value); + else if (cstr_eq(opt_name, "early_collect")) + options.early_collect = parse_bool(opt_value); else if (cstr_eq(opt_name, "min_free")) parse_min_free(opt_value); else if (cstr_eq(opt_name, "pre_alloc")) @@ -218,6 +224,7 @@ unittest assert (conservative == false); assert (fork == true); assert (eager_alloc == true); + assert (early_collect == false); assert (prealloc_psize == 0); assert (prealloc_npools == 0); assert (min_free == 5); @@ -231,6 +238,7 @@ unittest assert (conservative == false); assert (fork == true); assert (eager_alloc == true); + assert (early_collect == false); assert (prealloc_psize == 0); assert (prealloc_npools == 0); assert (min_free == 5); @@ -244,6 +252,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 0); assert (prealloc_npools == 0); assert (min_free == 5); @@ -257,11 +266,12 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 0); assert (prealloc_npools == 0); assert (min_free == 5); } - parse("pre_alloc:min_free=30"); + parse("pre_alloc:min_free=30:early_collect"); with (options) { assert (verbose == 1); assert (cstring.strcmp(log_file.ptr, "12345 67890".ptr) == 0); @@ -270,11 +280,12 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == true); assert (prealloc_psize == 0); assert (prealloc_npools == 0); assert (min_free == 30); } - parse("pre_alloc=1"); + parse("pre_alloc=1:early_collect=0"); with (options) { assert (verbose == 1); assert (cstring.strcmp(log_file.ptr, "12345 67890".ptr) == 0); @@ -283,6 +294,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 1 * 1024 * 1024); assert (prealloc_npools == 1); assert (min_free == 30); @@ -296,6 +308,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 1 * 1024 * 1024); assert (prealloc_npools == 1); assert (min_free == 30); @@ -309,6 +322,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 1 * 1024 * 1024); assert (prealloc_npools == 1); assert (min_free == 30); @@ -322,6 +336,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 9 * 1024 * 1024); assert (prealloc_npools == 10); assert (min_free == 30); @@ -335,6 +350,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 30); @@ -348,6 +364,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 30); @@ -361,6 +378,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 0); @@ -374,6 +392,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 100); @@ -387,6 +406,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 100); @@ -400,6 +420,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 100); @@ -413,6 +434,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 100); @@ -426,6 +448,7 @@ unittest assert (conservative == true); assert (fork == false); assert (eager_alloc == false); + assert (early_collect == false); assert (prealloc_psize == 5 * 1024 * 1024); assert (prealloc_npools == 2); assert (min_free == 100);