diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-21 23:37:18 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-21 23:37:18 +0000 |
commit | d32ad2efcaf6cf9babc6272482582dddda241a8f (patch) | |
tree | faea1abe62d57cceee19b0af844e47038ace9d89 | |
parent | 5890cb9d2d9ccd704b07764beba879bb9b97c2c9 (diff) | |
download | ruby-d32ad2efcaf6cf9babc6272482582dddda241a8f.tar.gz |
* gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
when memop type is MEMOP_TYPE_REALLOC.
GC at realloc is not well maintained.
We need a time to make it safe.
[ruby-dev:48117]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gc.c | 26 |
2 files changed, 22 insertions, 13 deletions
@@ -1,3 +1,12 @@ +Tue Apr 22 08:22:33 2014 Koichi Sasada <ko1@atdot.net> + + * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase + when memop type is MEMOP_TYPE_REALLOC. + + GC at realloc is not well maintained. + We need a time to make it safe. + [ruby-dev:48117] + Tue Apr 22 06:54:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> * gc.c (objspace_malloc_increase): run full mark if 0x04 bit is @@ -6097,20 +6097,20 @@ objspace_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, si #endif } - if (type == MEMOP_TYPE_MALLOC || type == MEMOP_TYPE_REALLOC) { - int full_mark = gc_stress_full_mark_after_malloc_p(); - if (ruby_gc_stress && !ruby_disable_gc_stress && ruby_native_thread_p()) { - garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC); - } - else { - retry: - if (malloc_increase > malloc_limit && ruby_native_thread_p()) { - if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) { - gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */ - goto retry; - } - garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC); + if (type != MEMOP_TYPE_FREE && + ruby_gc_stress && !ruby_disable_gc_stress && + ruby_native_thread_p()) { + garbage_collect_with_gvl(objspace, gc_stress_full_mark_after_malloc_p(), TRUE, GPR_FLAG_MALLOC); + } + + if (type == MEMOP_TYPE_MALLOC) { + retry: + if (malloc_increase > malloc_limit && ruby_native_thread_p()) { + if (ruby_thread_has_gvl_p() && is_lazy_sweeping(heap_eden)) { + gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */ + goto retry; } + garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC); } } |