From a6f7b83c323adcde55663e2c7dedffc39514a527 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 10 Jul 2020 03:41:09 +0200 Subject: [PATCH] Fix mark overflow processing (#38969) A recent refactoring PR #1688 has regressed GC processing of mark overflow. If GC heap segments in the segment linked list are not ordered in an ascending order by their addresses, the mark overflow processing misses segments on lower addresses if they follow segments on higher addresses. This leads to some objects that are alive to not to be reported and freed. This change fixes the problem by making sure the segment order doesn't matter. --- src/coreclr/src/gc/gc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/src/gc/gc.cpp b/src/coreclr/src/gc/gc.cpp index 2384889..57e5258 100644 --- a/src/coreclr/src/gc/gc.cpp +++ b/src/coreclr/src/gc/gc.cpp @@ -19869,10 +19869,10 @@ void gc_heap::process_mark_overflow_internal (int condemned_gen_number, int align_const = get_alignment_constant (i < uoh_start_generation); PREFIX_ASSUME(seg != NULL); - uint8_t* o = max (heap_segment_mem (seg), min_add); while (seg) { + uint8_t* o = max (heap_segment_mem (seg), min_add); uint8_t* end = heap_segment_allocated (seg); while ((o < end) && (o <= max_add)) -- 2.7.4