Skip to content

Commit

Permalink
should use heap_eden->total_pages.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ko1 committed May 28, 2019
1 parent 7233328 commit 2229aca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gc.c
Expand Up @@ -7496,15 +7496,16 @@ 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;
free->page = page;
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;
Expand Down

0 comments on commit 2229aca

Please sign in to comment.