Skip to content

Commit d22909e

Browse files
authored
need to account for unsuccessful commit case when hardlimit isn't on (#102961)
since we turn on the commit accounting for cases when hardlimit isn't on, when it's unsuccessful, we should deduct the bytes from the accounting.
1 parent 60edbf9 commit d22909e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7318,10 +7318,14 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb
73187318
#endif //USE_REGIONS
73197319

73207320
dprintf(3, ("commit-accounting: commit in %d [%p, %p) for heap %d", bucket, address, ((uint8_t*)address + size), h_number));
7321-
7322-
#ifndef USE_REGIONS
7323-
if (bucket != recorded_committed_ignored_bucket)
7321+
bool should_count =
7322+
#ifdef USE_REGIONS
7323+
true;
7324+
#else
7325+
(bucket != recorded_committed_ignored_bucket);
73247326
#endif //USE_REGIONS
7327+
7328+
if (should_count)
73257329
{
73267330
check_commit_cs.Enter();
73277331
bool exceeded_p = false;
@@ -7381,7 +7385,7 @@ bool gc_heap::virtual_commit (void* address, size_t size, int bucket, int h_numb
73817385
virtual_alloc_commit_for_heap (address, size, h_number)) :
73827386
GCToOSInterface::VirtualCommit(address, size));
73837387

7384-
if (!commit_succeeded_p && heap_hard_limit)
7388+
if (!commit_succeeded_p && should_count)
73857389
{
73867390
check_commit_cs.Enter();
73877391
committed_by_oh[bucket] -= size;

0 commit comments

Comments
 (0)