From ec5e8b5fac0ca3524c01b826a048b0b293b63a7d Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Sun, 31 Jul 2022 07:42:25 +0200 Subject: [PATCH] [GC] Handle objects from frozen segments in GCHeap::IsEphemeral (#73110) --- src/coreclr/gc/gc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 5c5970d3..e278bba 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -44690,6 +44690,13 @@ unsigned int GCHeap::GetGenerationWithRange (Object* object, uint8_t** ppStart, bool GCHeap::IsEphemeral (Object* object) { uint8_t* o = (uint8_t*)object; +#if defined(FEATURE_BASICFREEZE) && defined(USE_REGIONS) + if (!is_in_heap_range (o)) + { + // Objects in frozen segments are not ephemeral + return FALSE; + } +#endif gc_heap* hp = gc_heap::heap_of (o); return !!hp->ephemeral_pointer_p (o); } -- 2.7.4