From 41af533a344f78858dc934e9e2994836e81adab3 Mon Sep 17 00:00:00 2001 From: daan Date: Sun, 24 Nov 2019 19:17:56 -0800 Subject: [PATCH] define commit unit in terms of segment size --- include/mimalloc-types.h | 13 +++++++------ src/options.c | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/mimalloc-types.h b/include/mimalloc-types.h index 3cdc4963..9e183ca5 100644 --- a/include/mimalloc-types.h +++ b/include/mimalloc-types.h @@ -76,6 +76,7 @@ terms of the MIT license. A copy of the license can be found in the file #endif #define MI_INTPTR_SIZE (1< MI_LARGE_SIZE_MAX segment with just one huge page inside. } mi_segment_kind_t; -#define MI_COMMIT_SIZE (1UL<<20) // OS large page size +#define MI_COMMIT_SIZE (MI_SEGMENT_SIZE/MI_INTPTR_BITS) -#if ((1 << MI_SEGMENT_SHIFT)/MI_COMMIT_SIZE > 8*MI_INTPTR_SIZE) +#if (((1 << MI_SEGMENT_SHIFT)/MI_COMMIT_SIZE) > 8*MI_INTPTR_SIZE) #error "not enough commit bits to cover the segment size" #endif diff --git a/src/options.c b/src/options.c index dcee89e6..6fd887a3 100644 --- a/src/options.c +++ b/src/options.c @@ -64,7 +64,7 @@ static mi_option_desc_t options[_mi_option_last] = { 0, UNINIT, MI_OPTION(segment_reset) }, // reset segment memory on free (needs eager commit) { 1, UNINIT, MI_OPTION(reset_decommits) }, // reset decommits memory { 0, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed - { 1, UNINIT, MI_OPTION(allow_decommit) }, // decommit pages when not eager committed + { 0, UNINIT, MI_OPTION(allow_decommit) }, // decommit pages when not eager committed { 1000, UNINIT, MI_OPTION(reset_delay) }, // reset delay in milli-seconds { 1000, UNINIT, MI_OPTION(arena_reset_delay) }, // reset delay in milli-seconds { 0, UNINIT, MI_OPTION(use_numa_nodes) }, // 0 = use available numa nodes, otherwise use at most N nodes.