Skip to content

Commit cc4c736

Browse files
committed
Make sure committed bytes got reduced in case we fail to grow the brick card table
1 parent ddca725 commit cc4c736

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6017,7 +6017,18 @@ gc_heap::get_segment (size_t size, gc_oh_num oh)
60176017

60186018
if (gc_heap::grow_brick_card_tables (start, end, size, result, __this, uoh_p) != 0)
60196019
{
6020-
virtual_free (mem, size);
6020+
// release_segment needs the flags to decrement the proper bucket
6021+
size_t flags = 0;
6022+
if (oh == poh)
6023+
{
6024+
flags = heap_segment_flags_poh;
6025+
}
6026+
else if (oh == loh)
6027+
{
6028+
flags = heap_segment_flags_loh;
6029+
}
6030+
result->flags |= flags;
6031+
release_segment (result);
60216032
return 0;
60226033
}
60236034
}

0 commit comments

Comments
 (0)