Skip to content

Commit

Permalink
need to account for unsuccessful commit case when hardlimit isn't on (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
Maoni0 authored Jun 6, 2024
1 parent 60edbf9 commit d22909e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d22909e

Please sign in to comment.