Skip to content

Commit 5880bc2

Browse files
committed
Check if the child object is in the heap range before object_gennum
1 parent d48a44f commit 5880bc2

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/coreclr/gc/gc.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43428,8 +43428,15 @@ void GCHeap::SetYieldProcessorScalingFactor (float scalingFactor)
4342843428

4342943429
unsigned int GCHeap::WhichGeneration (Object* object)
4343043430
{
43431-
gc_heap* hp = gc_heap::heap_of ((uint8_t*)object);
43432-
unsigned int g = hp->object_gennum ((uint8_t*)object);
43431+
uint8_t* o = (uint8_t*)object;
43432+
#ifdef FEATURE_BASICFREEZE
43433+
if (!((o < g_gc_highest_address) && (o >= g_gc_lowest_address)))
43434+
{
43435+
return max_generation;
43436+
}
43437+
#endif //FEATURE_BASICFREEZE
43438+
gc_heap* hp = gc_heap::heap_of (o);
43439+
unsigned int g = hp->object_gennum (o);
4343343440
dprintf (3, ("%Ix is in gen %d", (size_t)object, g));
4343443441
return g;
4343543442
}

0 commit comments

Comments
 (0)