From 4fc597d4f4680be8e12dc8900400ec5c07983781 Mon Sep 17 00:00:00 2001 From: daanx Date: Tue, 4 Apr 2023 15:05:29 -0700 Subject: [PATCH] more tight purge delay --- src/arena.c | 7 ++++--- src/options.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/arena.c b/src/arena.c index 724fbaf4..e711c949 100644 --- a/src/arena.c +++ b/src/arena.c @@ -305,9 +305,10 @@ void* _mi_arena_alloc_aligned(size_t size, size_t alignment, size_t align_offset { mi_arena_id_t arena_id = 0; - bool arena_commit = _mi_os_has_overcommit(); - if (mi_option_get(mi_option_arena_eager_commit) == 1) { arena_commit = true; } - else if (mi_option_get(mi_option_arena_eager_commit) == 0) { arena_commit = false; } + // commit eagerly? + bool arena_commit = false; + if (mi_option_get(mi_option_arena_eager_commit) == 2) { arena_commit = _mi_os_has_overcommit(); } + else if (mi_option_get(mi_option_arena_eager_commit) == 1) { arena_commit = true; } if (mi_reserve_os_memory_ex(arena_reserve, arena_commit /* commit */, *large /* allow large*/, false /* exclusive */, &arena_id) == 0) { p = mi_arena_alloc_in(arena_id, numa_node, size, alignment, commit, large, is_pinned, is_zero, req_arena_id, memid, tld); diff --git a/src/options.c b/src/options.c index 5d4af7ba..580e1887 100644 --- a/src/options.c +++ b/src/options.c @@ -75,7 +75,7 @@ static mi_option_desc_t options[_mi_option_last] = #else { 1, UNINIT, MI_OPTION(eager_commit_delay) }, // the first N segments per thread are not eagerly committed (but per page in the segment on demand) #endif - { 100, UNINIT, MI_OPTION(reset_delay) }, // reset delay in milli-seconds + { 10, UNINIT, MI_OPTION(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. { 0, UNINIT, MI_OPTION(limit_os_alloc) }, // 1 = do not use OS memory for allocation (but only reserved arenas) { 100, UNINIT, MI_OPTION(os_tag) }, // only apple specific for now but might serve more or less related purpose @@ -89,7 +89,7 @@ static mi_option_desc_t options[_mi_option_last] = { 128L * 1024L, UNINIT, MI_OPTION(arena_reserve) }, #endif - { 500, UNINIT, MI_OPTION(arena_purge_delay) }, // reset/decommit delay in milli-seconds for arena allocation + { 100, UNINIT, MI_OPTION(arena_purge_delay) }, // reset/decommit delay in milli-seconds for arena allocation { 1, UNINIT, MI_OPTION(allow_purge) } // allow decommit/reset to free (physical) memory back to the OS };