[前][次][番号順一覧][スレッド一覧]

ruby-changes:58156

From: Aaron <ko1@a...>
Date: Tue, 8 Oct 2019 04:29:42 +0900 (JST)
Subject: [ruby-changes:58156] 6abcd35762 (master): Do not free too many pages.

https://git.ruby-lang.org/ruby.git/commit/?id=6abcd35762

From 6abcd35762db4bf49cd6c62a8c624e2a013e5dc1 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Mon, 7 Oct 2019 12:28:21 -0700
Subject: Do not free too many pages.

Sweep step checks `heap_pages_freeable_pages`, so compaction should do
the same.

diff --git a/gc.c b/gc.c
index 66bdb01..1815471 100644
--- a/gc.c
+++ b/gc.c
@@ -8409,10 +8409,12 @@ 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) {
+        if (page->free_slots == page->total_slots && heap_pages_freeable_pages > 0) {
             heap_pages_freeable_pages--;
 	    heap_unlink_page(objspace, heap_eden, page);
 	    heap_add_page(objspace, heap_tomb, page);
+        } else if (page->free_slots == page->total_slots) {
+            page->free_next = NULL;
         }
         objspace->profile.total_freed_objects++;
         moved_list = next_moved;
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]