summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-06-29 14:32:28 -0400
committerPeter Zhu <peter@peterzhu.ca>2021-07-15 11:48:52 -0400
commit119697f61e2b2b157816a8aa33aada5863959900 (patch)
treea8d98d492b0141f5ca5ea21b448f5a075e1445c5
parent3e7a7fb28a9a6a9544e1e49dfab51122ccfdac3f (diff)
downloadruby-119697f61e2b2b157816a8aa33aada5863959900.tar.gz
[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.
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
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);