Skip to content

Commit 6f9dc2e

Browse files
committed
Add GC sweep bookkeeping assertions on sweep_finish
1 parent a65fc82 commit 6f9dc2e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

gc/default/default.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,6 +5061,18 @@ gc_sweep_finish(rb_objspace_t *objspace)
50615061
for (int i = 0; i < HEAP_COUNT; i++) {
50625062
rb_heap_t *heap = &heaps[i];
50635063

5064+
#ifdef DEBUG_SWEEP_BOOKKEEPING
5065+
{
5066+
/* Assert that every page in this heap was swept. */
5067+
struct heap_page *page;
5068+
ccan_list_for_each(&heap->pages, page, page_node) {
5069+
if (RUBY_ATOMIC_LOAD(page->before_sweep)) {
5070+
rb_bug("gc_sweep_finish: page %p in heap %d still has before_sweep set", (void *)page, i);
5071+
}
5072+
}
5073+
}
5074+
#endif
5075+
50645076
heap->freed_slots = 0;
50655077
heap->empty_slots = 0;
50665078
if (heap->background_sweep_steps < heap->foreground_sweep_steps) {

0 commit comments

Comments
 (0)