diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-21 21:54:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-21 21:54:17 +0000 |
commit | 5890cb9d2d9ccd704b07764beba879bb9b97c2c9 (patch) | |
tree | a8fe50c5f1401b31993a0ee861e5d93eaa893cb5 /gc.c | |
parent | 2abb976deb80c6f93dc31b8471f0a844a33795a1 (diff) | |
download | ruby-5890cb9d2d9ccd704b07764beba879bb9b97c2c9.tar.gz |
gc.c: full mark after malloc/realloc
* gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
set in ruby_gc_stress. [ruby-core:62103] [Feature #9761]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -5020,9 +5020,13 @@ rb_global_variable(VALUE *var) enum { gc_stress_no_major, gc_stress_no_immediate_sweep, + gc_stress_full_mark_after_malloc, gc_stress_max }; +#define gc_stress_full_mark_after_malloc_p() \ + (FIXNUM_P(ruby_gc_stress) && (FIX2LONG(ruby_gc_stress) & (1<<gc_stress_full_mark_after_malloc))) + static int garbage_collect_body(rb_objspace_t *objspace, int full_mark, int immediate_sweep, int reason) { @@ -5653,6 +5657,7 @@ gc_stress_get(VALUE self) * flag can be true, false, or a fixnum bit-ORed following flags. * 0x01:: no major GC * 0x02:: no immediate sweep + * 0x04:: full mark after malloc/calloc/realloc */ static VALUE @@ -6093,8 +6098,9 @@ objspace_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, si } 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, FALSE, TRUE, GPR_FLAG_MALLOC); + garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC); } else { retry: @@ -6103,7 +6109,7 @@ objspace_malloc_increase(rb_objspace_t *objspace, void *mem, size_t new_size, si gc_rest_sweep(objspace); /* rest_sweep can reduce malloc_increase */ goto retry; } - garbage_collect_with_gvl(objspace, FALSE, TRUE, GPR_FLAG_MALLOC); + garbage_collect_with_gvl(objspace, full_mark, TRUE, GPR_FLAG_MALLOC); } } } |