From 119697f61e2b2b157816a8aa33aada5863959900 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 29 Jun 2021 14:32:28 -0400 Subject: [Bug #18014] Fix rb_gc_force_recycle unmark before sweep If we force recycle an object before the page is swept, we should clear it in the mark bitmap. If we don't clear it in the bitmap, then during sweeping we won't account for this free slot so the `free_slots` count of the page will be incorrect. --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index ff2f308a88..c7e3034240 100644 --- a/gc.c +++ b/gc.c @@ -8671,7 +8671,7 @@ rb_gc_force_recycle(VALUE obj) } else { #endif - if (is_old || !GET_HEAP_PAGE(obj)->flags.before_sweep) { + if (is_old || GET_HEAP_PAGE(obj)->flags.before_sweep) { CLEAR_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj); } CLEAR_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), obj); -- cgit v1.2.1