aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-04 08:54:46 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-04 08:54:46 +0000
commit158b9e75de4ce7ec9d4d867ffb032eedd2f10235 (patch)
treee4a0955b0ca9ab6ea2d7b78a2cfd9155160f0550
parentdadd9bc24d7bdb80ee71364f1978d9344ce35dee (diff)
downloadruby-158b9e75de4ce7ec9d4d867ffb032eedd2f10235.tar.gz
* gc.c (heap_page_resurrect): do not return tomb_pages when
page->freelist == NULL. [Bug #12670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--gc.c12
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 63e8998327..01c798ba82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Nov 4 17:52:44 2016 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (heap_page_resurrect): do not return tomb_pages when
+ page->freelist == NULL.
+ [Bug #12670]
+
Fri Nov 4 16:31:45 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* util.c (ruby_dtoa): round to even, instead of rounding to
diff --git a/gc.c b/gc.c
index 1eb3f77fd8..9f1e2b3419 100644
--- a/gc.c
+++ b/gc.c
@@ -1550,12 +1550,16 @@ heap_page_allocate(rb_objspace_t *objspace)
static struct heap_page *
heap_page_resurrect(rb_objspace_t *objspace)
{
- struct heap_page *page;
+ struct heap_page *page = heap_tomb->pages;
- if ((page = heap_tomb->pages) != NULL) {
- heap_unlink_page(objspace, heap_tomb, page);
- return page;
+ while (page) {
+ if (page->freelist != NULL) {
+ heap_unlink_page(objspace, heap_tomb, page);
+ return page;
+ }
+ page = page->next;
}
+
return NULL;
}