ruby-changes:58155
From: Aaron <ko1@a...>
Date: Tue, 8 Oct 2019 04:11:14 +0900 (JST)
Subject: [ruby-changes:58155] 058db33c5e (master): Move empty pages to the tomb
https://git.ruby-lang.org/ruby.git/commit/?id=058db33c5e From 058db33c5ec881271d028b7490d88b3baed74acb Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Mon, 7 Oct 2019 12:10:24 -0700 Subject: Move empty pages to the tomb I think we need to be moving empty pages to the tomb after they become empty. diff --git a/gc.c b/gc.c index 28ac208..66bdb01 100644 --- a/gc.c +++ b/gc.c @@ -8397,10 +8397,6 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8397 heap_eden->free_pages = NULL; heap_eden->using_page = NULL; - if (use_verifier) { - gc_verify_internal_consistency(objspace); - } - while (moved_list) { VALUE next_moved; struct heap_page *page; @@ -8413,10 +8409,19 @@ gc_compact_after_gc(rb_objspace_t *objspace, int use_toward_empty, int use_doubl https://github.com/ruby/ruby/blob/trunk/gc.c#L8409 RMOVED(moved_list)->next = 0; page->free_slots++; heap_page_add_freeobj(objspace, page, moved_list); + if (page->free_slots == page->total_slots) { + heap_pages_freeable_pages--; + heap_unlink_page(objspace, heap_eden, page); + heap_add_page(objspace, heap_tomb, page); + } objspace->profile.total_freed_objects++; moved_list = next_moved; } + if (use_verifier) { + gc_verify_internal_consistency(objspace); + } + mjit_gc_exit_hook(); // unlock MJIT here, because `rb_gc()` calls `mjit_gc_start_hook()` again. } -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/