diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 2aba247257637..98e81eddd2c51 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -7318,10 +7318,14 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb #endif //USE_REGIONS dprintf(3, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number)); - -#ifndef USE_REGIONS - if (bucket != recorded_committed_ignored_bucket) + bool should_count = +#ifdef USE_REGIONS + true; +#else + (bucket != recorded_committed_ignored_bucket); #endif //USE_REGIONS + + if (should_count) { check_commit_cs.Enter(); bool exceeded_p = false; @@ -7381,7 +7385,7 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb virtual_alloc_commit_for_heap (address, size, h_number)) : GCToOSInterface::VirtualCommit(address, size)); - if (!commit_succeeded_p && heap_hard_limit) + if (!commit_succeeded_p && should_count) { check_commit_cs.Enter(); committed_by_oh[bucket] -= size;