summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-05-28 11:41:03 +0900
committerKoichi Sasada <ko1@atdot.net>2019-05-28 11:44:08 +0900
commit2229acaa54e1011ae77710e10f8c9e7933403127 (patch)
tree873ac0b81f77fe3ce539592f9f2968ac6e52a5b6 /gc.c
parent72333286c45ac821e227ad62d810a09a0208ecbb (diff)
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.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c5
1 files changed, 3 insertions, 2 deletions
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;