diff --git a/include/mimalloc.h b/include/mimalloc.h index 3c10a65b..95ba82e5 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -224,14 +224,14 @@ typedef enum mi_option_e { mi_option_show_errors, mi_option_verbose, // the following options are experimental - mi_option_page_reset, - mi_option_cache_reset, + mi_option_secure, mi_option_eager_commit, mi_option_eager_region_commit, mi_option_large_os_pages, // implies eager commit + mi_option_page_reset, + mi_option_cache_reset, mi_option_reset_decommits, mi_option_reset_discards, - mi_option_secure, _mi_option_last } mi_option_t; diff --git a/src/options.c b/src/options.c index 3cdcf7e6..bc658ca9 100644 --- a/src/options.c +++ b/src/options.c @@ -31,26 +31,31 @@ typedef struct mi_option_desc_s { const char* name; // option name without `mimalloc_` prefix } mi_option_desc_t; -static mi_option_desc_t options[_mi_option_last] = +static mi_option_desc_t options[_mi_option_last] = { // stable options { 0, UNINIT, "show_stats" }, { MI_DEBUG, UNINIT, "show_errors" }, { 0, UNINIT, "verbose" }, + #if MI_SECURE + { MI_SECURE, INITIALIZED, "secure" }, // in a secure build the environment setting is ignored + #else + { 0, UNINIT, "secure" }, + #endif + // the following options are experimental and not all combinations make sense. + { 1, UNINIT, "eager_commit" }, // note: if eager_region_commit is on, this should be on too. + #ifdef _WIN32 // and BSD? + { 0, UNINIT, "eager_region_commit" }, // don't commit too eagerly on windows (just for looks...) + #else + { 1, UNINIT, "eager_region_commit" }, + #endif + { 0, UNINIT, "large_os_pages" }, // use large OS pages, use only with eager commit to prevent fragmentation of VMA's { 0, UNINIT, "page_reset" }, { 0, UNINIT, "cache_reset" }, - { 1, UNINIT, "eager_commit" }, - { 1, UNINIT, "eager_region_commit" }, // eager_commit should be on when eager_region_commit is on - { 0, UNINIT, "large_os_pages" }, // use large OS pages, use only with eager commit to prevent fragmentation of VMA's - { 0, UNINIT, "reset_decommits" }, - { 0, UNINIT, "reset_discards" }, - #if MI_SECURE - { MI_SECURE, INITIALIZED, "secure" } // in a secure build the environment setting is ignored - #else - { 0, UNINIT, "secure" } - #endif + { 0, UNINIT, "reset_decommits" }, // note: cannot enable this if secure is on + { 0, UNINIT, "reset_discards" } // note: cannot enable this if secure is on }; static void mi_option_init(mi_option_desc_t* desc);