From 9782d219f34aded1d0b80f7bdff809132550561e Mon Sep 17 00:00:00 2001 From: ko1 Date: Sat, 9 Nov 2013 16:35:54 +0000 Subject: [PATCH] * gc.c (vm_malloc_increase): sweep immediately on GC due to malloc(). To reduce memory usage, sweep as soon as possible. This behavior is same as Ruby 2.0.0 and before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ gc.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63fd388fb2..9ba9221a08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Nov 10 01:34:14 2013 Koichi Sasada + + * gc.c (vm_malloc_increase): sweep immediately on GC due to malloc(). + To reduce memory usage, sweep as soon as possible. + This behavior is same as Ruby 2.0.0 and before. + Sun Nov 10 00:39:26 2013 Koichi Sasada * benchmark/gc/gcbench.rb: output version description and GC::OPTS. diff --git a/gc.c b/gc.c index dda3292b60..4b0fb1c0a3 100644 --- a/gc.c +++ b/gc.c @@ -5449,7 +5449,7 @@ vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, in if (do_gc) { if (ruby_gc_stress && !ruby_disable_gc_stress) { - garbage_collect_with_gvl(objspace, 0, 0, GPR_FLAG_MALLOC); + garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC); } else { retry: @@ -5458,7 +5458,7 @@ vm_malloc_increase(rb_objspace_t *objspace, size_t new_size, size_t old_size, in gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */ goto retry; } - garbage_collect_with_gvl(objspace, 0, 0, GPR_FLAG_MALLOC); + garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC); } } }