Skip to content

Commit 4826e8e

Browse files
committed
[MERGE #5358 @atulkatti] MSFT:17387958 The NewFinalizeBit may not have been cleared in OOM cases if trackable objects have not been processed.
Merge pull request #5358 from atulkatti:Bug17387958.NewFinalizeBitAssert.1
2 parents a3268d7 + 4ba3daf commit 4826e8e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/Common/Memory/LargeHeapBlock.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,11 @@ LargeHeapBlock::VerifyMark()
10001000

10011001
unsigned char attributes = header->GetAttributes(this->heapInfo->recycler->Cookie);
10021002

1003-
Assert((attributes & NewFinalizeBit) == 0);
1003+
// In case of OOM we may not have completed processing of trackable objects and the NewFinalizeBit may not have been cleared.
1004+
if ((attributes & (TrackBit | NewTrackBit)) == (TrackBit | NewTrackBit))
1005+
{
1006+
Assert((attributes & NewFinalizeBit) == 0);
1007+
}
10041008

10051009
if ((attributes & LeafBit) != 0)
10061010
{
@@ -1981,7 +1985,12 @@ LargeHeapBlock::SweepObjects(Recycler * recycler)
19811985
if (heapBlockMap.IsMarked(header->GetAddress()))
19821986
{
19831987
#if DBG
1984-
Assert((header->GetAttributes(recycler->Cookie) & NewFinalizeBit) == 0);
1988+
unsigned char attributes = header->GetAttributes(recycler->Cookie);
1989+
// In case of OOM we may not have completed processing of trackable objects and the NewFinalizeBit may not have been cleared.
1990+
if ((attributes & (TrackBit | NewTrackBit)) == (TrackBit | NewTrackBit))
1991+
{
1992+
Assert((attributes & NewFinalizeBit) == 0);
1993+
}
19851994
#endif
19861995

19871996
RECYCLER_STATS_ADD(recycler, largeHeapBlockUsedByteCount, this->GetHeaderByIndex(i)->objectSize);

0 commit comments

Comments
 (0)