From 25fdd50666bec00c99f0843b0d168ce54f1acd42 Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 8 Jun 2025 15:36:10 -0700 Subject: [PATCH 1/2] return NULL in mi_arena_try_alloc_at if we cannot commit but commit was requested --- src/arena.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/arena.c b/src/arena.c index 0d86669b..d0e60db7 100644 --- a/src/arena.c +++ b/src/arena.c @@ -216,20 +216,21 @@ static mi_decl_noinline void* mi_arena_try_alloc_at( // now actually commit bool commit_zero = false; if (!_mi_os_commit_ex(p, mi_size_of_slices(slice_count), &commit_zero, mi_size_of_slices(slice_count - already_committed_count))) { - memid->initially_committed = false; + // if the commit fails, roll back and return NULL + _mi_arenas_free(p, mi_size_of_slices(slice_count), *memid); // this will decommit as well (if partially committed) + return NULL; } - else { - // committed - if (commit_zero) { memid->initially_zero = true; } - #if MI_DEBUG > 1 - if (memid->initially_zero) { - if (!mi_mem_is_zero(p, mi_size_of_slices(slice_count))) { - _mi_error_message(EFAULT, "interal error: arena allocation was not zero-initialized!\n"); - memid->initially_zero = false; - } + + // committed + if (commit_zero) { memid->initially_zero = true; } + #if MI_DEBUG > 1 + if (memid->initially_zero) { + if (!mi_mem_is_zero(p, mi_size_of_slices(slice_count))) { + _mi_error_message(EFAULT, "interal error: arena allocation was not zero-initialized!\n"); + memid->initially_zero = false; } - #endif } + #endif } else { // already fully commited. From 8b2f7746564da2be0766db49414d16a64590d8c7 Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 8 Jun 2025 15:39:46 -0700 Subject: [PATCH 2/2] auto run azure pipeline --- azure-pipelines.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index acb92a28..61b18c4b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,10 +6,8 @@ trigger: branches: include: - - master - - dev - - dev2 - - dev3 + - main + - dev* tags: include: - v*