From d8c47bfed2b053f6cc630fa364284523e0bd0ffd Mon Sep 17 00:00:00 2001 From: daan Date: Tue, 9 Jul 2019 23:37:59 -0700 Subject: [PATCH] ensure commit of reused cached segments --- src/segment.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/segment.c b/src/segment.c index 783de31e..6d8c5a24 100644 --- a/src/segment.c +++ b/src/segment.c @@ -359,13 +359,16 @@ static mi_segment_t* mi_segment_alloc( size_t required, mi_page_kind_t page_kind protection_still_good = true; // otherwise, the guard pages are still in place } } + if (page_kind != MI_PAGE_SMALL && !mi_option_is_enabled(mi_option_eager_commit) && + (mi_option_is_enabled(mi_option_cache_reset) || mi_option_is_enabled(mi_option_page_reset))) { + _mi_os_commit(segment, segment->segment_size, tld->stats); + } } // and otherwise allocate it from the OS else { segment = (mi_segment_t*)_mi_os_alloc_aligned(segment_size, MI_SEGMENT_SIZE, commit, os_tld); if (segment == NULL) return NULL; mi_segments_track_size((long)segment_size,tld); - } mi_assert_internal(segment != NULL && (uintptr_t)segment % MI_SEGMENT_SIZE == 0); if (!commit) {