ruby-changes:66799
From: Peter <ko1@a...>
Date: Fri, 16 Jul 2021 00:49:10 +0900 (JST)
Subject: [ruby-changes:66799] 119697f61e (master): [Bug #18014] Fix rb_gc_force_recycle unmark before sweep
https://git.ruby-lang.org/ruby.git/commit/?id=119697f61e From 119697f61e2b2b157816a8aa33aada5863959900 Mon Sep 17 00:00:00 2001 From: Peter Zhu <peter@p...> 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(-) diff --git a/gc.c b/gc.c index ff2f308..c7e3034 100644 --- a/gc.c +++ b/gc.c @@ -8671,7 +8671,7 @@ rb_gc_force_recycle(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L8671 } 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.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/