Skip to content

Commit

Permalink
Reduce committed bytes if mark array commit fails (#106400)
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung authored Aug 23, 2024
1 parent 05b07f4 commit 4179b31
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9607,6 +9607,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
#endif //CARD_BUNDLE

size_t alloc_size = card_table_element_layout[total_bookkeeping_elements];
size_t commit_size = 0;
uint8_t* mem = (uint8_t*)GCToOSInterface::VirtualReserve (alloc_size, 0, virtual_reserve_flags);

if (!mem)
Expand All @@ -9620,14 +9621,16 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,

{
// in case of background gc, the mark array will be committed separately (per segment).
size_t commit_size = card_table_element_layout[seg_mapping_table_element + 1];
commit_size = card_table_element_layout[seg_mapping_table_element + 1];

if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket))
{
commit_size = 0;
dprintf (GC_TABLE_LOG, ("Table commit failed"));
set_fgm_result (fgm_commit_table, commit_size, uoh_p);
goto fail;
}

}

ct = (uint32_t*)(mem + card_table_element_layout[card_table_element]);
Expand Down Expand Up @@ -9799,6 +9802,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
dprintf (GC_TABLE_LOG, ("GCToOSInterface::VirtualRelease failed"));
assert (!"release failed");
}
reduce_committed_bytes (mem, commit_size, recorded_committed_bookkeeping_bucket, -1, true);
}

return -1;
Expand Down Expand Up @@ -47769,10 +47773,6 @@ void gc_heap::verify_committed_bytes_per_heap()

void gc_heap::verify_committed_bytes()
{
#ifndef USE_REGIONS
// TODO, https://github.com/dotnet/runtime/issues/102706, re-enable the testing after fixing this bug
return;
#endif //!USE_REGIONS
size_t total_committed = 0;
size_t committed_decommit; // unused
size_t committed_free; // unused
Expand Down

0 comments on commit 4179b31

Please sign in to comment.