diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 21:35:40 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 21:35:40 +0000 |
commit | 81ed2d3c4aa19c03a6e2d644c853e5977fb53cc8 (patch) | |
tree | 7895f84150f3d96638f650f91f9ae62d7f2c1f05 /gc.c | |
parent | 5a70af1d59b85c4987330b5ff8e3ef1cbb6e5668 (diff) |
* gc.c (gc_stress_set): add special option of GC.stress.
`GC.stress=(flag)' accepts integer to control behavior of GC.
See code for details. Of course, this feature is only for MRI.
You can debug RGenGC (WB) using `GC.stress = 1'.
Using this option, do minor marking at all possible places.
GC::STRESS_MINOR_MARK = 1 and GC::STRESS_LAZY_SWEEP = 2
seem good to add.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -3833,6 +3833,13 @@ garbage_collect_body(rb_objspace_t *objspace, int full_mark, int immediate_sweep if (ruby_gc_stress && !ruby_disable_gc_stress) { minor_gc = FALSE; immediate_sweep = TRUE; + + if (FIXNUM_P(ruby_gc_stress)) { + int flag = ruby_gc_stress; + + if (flag & 0x01) minor_gc = TRUE; + if (flag & 0x02) immediate_sweep = FALSE; + } } else { if (full_mark) { @@ -4171,7 +4178,7 @@ gc_stress_set(VALUE self, VALUE flag) { rb_objspace_t *objspace = &rb_objspace; rb_secure(2); - ruby_gc_stress = RTEST(flag); + ruby_gc_stress = FIXNUM_P(flag) ? flag : (RTEST(flag) ? Qtrue : Qfalse); return flag; } |