check for decommit allowed before purging the segment cache

This commit is contained in:
Daan 2022-02-03 15:51:27 -08:00
parent cbcee4dce4
commit 0e1beb0018
2 changed files with 2 additions and 2 deletions

View file

@ -118,6 +118,7 @@ static mi_decl_noinline void mi_commit_mask_decommit(mi_commit_mask_t* cmask, vo
static mi_decl_noinline void mi_segment_cache_purge(bool force, mi_os_tld_t* tld)
{
MI_UNUSED(tld);
if (!mi_option_is_enabled(mi_option_allow_decommit)) return;
mi_msecs_t now = _mi_clock_now();
size_t purged = 0;
const size_t max_visits = (force ? MI_CACHE_MAX /* visit all */ : MI_CACHE_FIELDS /* probe at most N (=16) slots */);

View file

@ -569,8 +569,7 @@ static void mi_segment_perhaps_decommit(mi_segment_t* segment, uint8_t* p, size_
mi_commit_mask_t cmask;
mi_commit_mask_create_intersect(&segment->commit_mask, &mask, &cmask); // only decommit what is committed; span_free may try to decommit more
mi_commit_mask_set(&segment->decommit_mask, &cmask);
// segment->decommit_expire = _mi_clock_now() + mi_option_get(mi_option_decommit_delay);
mi_msecs_t now = _mi_clock_now();
mi_msecs_t now = _mi_clock_now();
if (segment->decommit_expire == 0) {
// no previous decommits, initialize now
mi_assert_internal(mi_commit_mask_is_empty(&segment->decommit_mask));