summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--gc.c9
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5168aa58dd..6a2381d11b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Jun 19 06:31:08 2013 Koichi Sasada <ko1@atdot.net>
+
+ * 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.
+
Wed Jun 19 06:29:31 2013 Koichi Sasada <ko1@atdot.net>
* vm.c (kwmerge_i): add WB.
diff --git a/gc.c b/gc.c
index c85c5520ce..02928af078 100644
--- a/gc.c
+++ b/gc.c
@@ -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;
}