From 4fc38627f4b471de7ac9c96743850d659029c2e6 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 22 Jan 2019 01:01:45 +0300 Subject: [PATCH] Fix 'unexpected mark stack overflow' abort in push_all_stack (a cherry-pick of commit 420a4768 from 'release-7_6') Issue #260 (bdwgc). * mark.c [!(THREADS && MPROTECT_VDB)] (GC_push_all_stack): Call GC_push_all_eager() instead of GC_push_all() if GC_mark_stack_top is rather close to GC_mark_stack_limit. --- mark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mark.c b/mark.c index 969a02b3..28098829 100644 --- a/mark.c +++ b/mark.c @@ -1552,7 +1552,9 @@ GC_INNER void GC_push_all_stack(ptr_t bottom, ptr_t top) # if defined(THREADS) && defined(MPROTECT_VDB) GC_push_all_eager(bottom, top); # else - if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) { + if (!NEED_FIXUP_POINTER && GC_all_interior_pointers + && (word)GC_mark_stack_top + < (word)(GC_mark_stack_limit - INITIAL_MARK_STACK_SIZE/8)) { GC_push_all(bottom, top); } else { GC_push_all_eager(bottom, top); -- 2.40.0