summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 9af83de055..9ccd26d19c 100644
--- a/gc.c
+++ b/gc.c
@@ -5483,6 +5483,18 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
}
}
+#if RGENGC_CHECK_MODE
+ short freelist_len = 0;
+ RVALUE *ptr = sweep_page->freelist;
+ while (ptr) {
+ freelist_len++;
+ ptr = ptr->as.free.next;
+ }
+ if (freelist_len != sweep_page->free_slots) {
+ rb_bug("inconsistent freelist length: expected %d but was %d", sweep_page->free_slots, freelist_len);
+ }
+#endif
+
gc_report(2, objspace, "page_sweep: end.\n");
return ctx.freed_slots + ctx.empty_slots;