From 2229acaa54e1011ae77710e10f8c9e7933403127 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Tue, 28 May 2019 11:41:03 +0900 Subject: should use heap_eden->total_pages. The size of page_list is heap_eden->total_pages, but init_cursors() assumes the size of page_list is `heap_allocated_pages`. This patch fix it. --- gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index a633b6e5f9..cf9d1e4039 100644 --- a/gc.c +++ b/gc.c @@ -7496,6 +7496,7 @@ static void init_cursors(rb_objspace_t *objspace, struct heap_cursor *free, struct heap_cursor *scan, struct heap_page **page_list) { struct heap_page *page; + size_t total_pages = heap_eden->total_pages; page = page_list[0]; free->index = 0; @@ -7503,8 +7504,8 @@ init_cursors(rb_objspace_t *objspace, struct heap_cursor *free, struct heap_curs free->slot = page->start; free->objspace = objspace; - page = page_list[heap_allocated_pages - 1]; - scan->index = heap_allocated_pages - 1; + page = page_list[total_pages - 1]; + scan->index = total_pages - 1; scan->page = page; scan->slot = page->start + page->total_slots - 1; scan->objspace = objspace; -- cgit v1.2.3