From 0e2df71829597295c94426539d00c08414d2725b Mon Sep 17 00:00:00 2001 From: daan Date: Fri, 4 Feb 2022 16:11:38 -0800 Subject: [PATCH] increase minimal commit size to 8*slice-size and add decommit_extend_delay as option --- include/mimalloc-types.h | 4 ++-- include/mimalloc.h | 1 + src/options.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/mimalloc-types.h b/include/mimalloc-types.h index 41364286..8cd3a4c3 100644 --- a/include/mimalloc-types.h +++ b/include/mimalloc-types.h @@ -320,10 +320,10 @@ typedef enum mi_segment_kind_e { // the corresponding MI_COMMIT_SIZE area is committed. // The MI_COMMIT_SIZE must be a multiple of the slice // size. If it is equal we have the most fine grained -// decommit (but in practice 2x seems to perform better). +// decommit but setting it higher can be more efficient. // ------------------------------------------------------ -#define MI_COMMIT_SIZE (MI_SEGMENT_SLICE_SIZE) +#define MI_COMMIT_SIZE (8*MI_SEGMENT_SLICE_SIZE) #define MI_COMMIT_MASK_BITS (MI_SEGMENT_SIZE / MI_COMMIT_SIZE) #define MI_COMMIT_MASK_FIELD_BITS MI_SIZE_BITS #define MI_COMMIT_MASK_FIELD_COUNT (MI_COMMIT_MASK_BITS / MI_COMMIT_MASK_FIELD_BITS) diff --git a/include/mimalloc.h b/include/mimalloc.h index 06597e9a..08805845 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -328,6 +328,7 @@ typedef enum mi_option_e { mi_option_max_warnings, mi_option_allow_decommit, mi_option_segment_decommit_delay, + mi_option_decommit_extend_delay, _mi_option_last } mi_option_t; diff --git a/src/options.c b/src/options.c index 388be2e6..d2e61218 100644 --- a/src/options.c +++ b/src/options.c @@ -92,7 +92,8 @@ static mi_option_desc_t options[_mi_option_last] = { 16, UNINIT, MI_OPTION(max_errors) }, // maximum errors that are output { 16, UNINIT, MI_OPTION(max_warnings) }, // maximum warnings that are output { 1, UNINIT, MI_OPTION(allow_decommit) }, // decommit slices when no longer used (after decommit_delay milli-seconds) - { 500, UNINIT, MI_OPTION(segment_decommit_delay) } // decommit delay in milli-seconds for freed segments + { 500, UNINIT, MI_OPTION(segment_decommit_delay) }, // decommit delay in milli-seconds for freed segments + { 2, UNINIT, MI_OPTION(decommit_extend_delay) } }; static void mi_option_init(mi_option_desc_t* desc);