From: Jan Vorlicek Date: Fri, 10 Jul 2020 01:41:09 +0000 (+0200) Subject: Fix mark overflow processing (#38969) X-Git-Tag: submit/tizen/20210909.063632~6825 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6f7b83c323adcde55663e2c7dedffc39514a527;p=platform%2Fupstream%2Fdotnet%2Fruntime.git 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. --- 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))