Skip to content

Commit 4179b31

Browse files
authored
Reduce committed bytes if mark array commit fails (#106400)
1 parent 05b07f4 commit 4179b31

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9607,6 +9607,7 @@ int gc_heap::grow_brick_card_tables (uint8_t* start,
96079607
#endif //CARD_BUNDLE
96089608

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

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

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

96259626
if (!virtual_commit (mem, commit_size, recorded_committed_bookkeeping_bucket))
96269627
{
9628+
commit_size = 0;
96279629
dprintf (GC_TABLE_LOG, ("Table commit failed"));
96289630
set_fgm_result (fgm_commit_table, commit_size, uoh_p);
96299631
goto fail;
96309632
}
9633+
96319634
}
96329635

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

98049808
return -1;
@@ -47769,10 +47773,6 @@ void gc_heap::verify_committed_bytes_per_heap()
4776947773

4777047774
void gc_heap::verify_committed_bytes()
4777147775
{
47772-
#ifndef USE_REGIONS
47773-
// TODO, https://github.com/dotnet/runtime/issues/102706, re-enable the testing after fixing this bug
47774-
return;
47775-
#endif //!USE_REGIONS
4777647776
size_t total_committed = 0;
4777747777
size_t committed_decommit; // unused
4777847778
size_t committed_free; // unused

0 commit comments

Comments
 (0)