* gc.c (heap_pages_free_unused_pages): check tomb page availability
at first. And return immediately if we don't touch sorted list any more. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a8cb9b02a0
commit
8467d86f8a
@ -1,3 +1,9 @@
|
|||||||
|
Wed Feb 26 18:43:43 2014 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* gc.c (heap_pages_free_unused_pages): check tomb page availability
|
||||||
|
at first.
|
||||||
|
And return immediately if we don't touch sorted list any more.
|
||||||
|
|
||||||
Wed Feb 26 14:10:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Feb 26 14:10:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (setup_exception): preserve exception class name encoding
|
* eval.c (setup_exception): preserve exception class name encoding
|
||||||
|
36
gc.c
36
gc.c
@ -999,28 +999,30 @@ heap_pages_free_unused_pages(rb_objspace_t *objspace)
|
|||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
for (i = j = 1; j < heap_pages_used; i++) {
|
if (heap_tomb->pages) {
|
||||||
struct heap_page *page = heap_pages_sorted[i];
|
for (i = j = 1; j < heap_pages_used; i++) {
|
||||||
|
struct heap_page *page = heap_pages_sorted[i];
|
||||||
|
|
||||||
if (page->heap == heap_tomb && page->final_slots == 0) {
|
if (page->heap == heap_tomb && page->final_slots == 0) {
|
||||||
if (heap_pages_swept_slots - page->limit > heap_pages_max_free_slots) {
|
if (heap_pages_swept_slots - page->limit > heap_pages_max_free_slots) {
|
||||||
if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_slots: %d, heap_pages_max_free_slots: %d\n",
|
if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_slots: %d, heap_pages_max_free_slots: %d\n",
|
||||||
(int)i, page, (int)heap_pages_swept_slots, (int)heap_pages_max_free_slots);
|
(int)i, page, (int)heap_pages_swept_slots, (int)heap_pages_max_free_slots);
|
||||||
heap_pages_swept_slots -= page->limit;
|
heap_pages_swept_slots -= page->limit;
|
||||||
heap_unlink_page(objspace, heap_tomb, page);
|
heap_unlink_page(objspace, heap_tomb, page);
|
||||||
heap_page_free(objspace, page);
|
heap_page_free(objspace, page);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
else if (i == j) {
|
||||||
|
return; /* no need to check rest pages */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
if (i != j) {
|
||||||
/* fprintf(stderr, "heap_pages_free_unused_pages: remain!!\n"); */
|
heap_pages_sorted[j] = page;
|
||||||
}
|
}
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
if (i != j) {
|
assert(j == heap_pages_used);
|
||||||
heap_pages_sorted[j] = page;
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
assert(j == heap_pages_used);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct heap_page *
|
static struct heap_page *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user