From 470c9d844b11f003d0118def80a08fb2437fd0d0 Mon Sep 17 00:00:00 2001 From: tmm1 Date: Fri, 6 Dec 2013 05:11:51 +0000 Subject: gc.c: add minor marking and lazy sweeping options to GC.start * gc.c (gc_start_internal): GC.start() now accepts two optional keyword arguments. These can be used to disable full_mark (minor mark only) or disable immediate_sweep (use lazy sweep). These new options are useful for benchmarking GC behavior, or performing minor GC out-of-band. * test/ruby/test_gc.rb (class TestGc): tests for new options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/ruby/test_gc.rb') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 76104fedfe..f45983156e 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -48,6 +48,22 @@ class TestGc < Test::Unit::TestCase GC.enable end + def test_start_full_mark + GC.start(full_mark: false) + assert_nil GC.latest_gc_info(:major_by) + + GC.start(full_mark: true) + assert_not_nil GC.latest_gc_info(:major_by) + end + + def test_start_immediate_sweep + GC.start(immediate_sweep: false) + assert_equal false, GC.latest_gc_info(:immediate_sweep) + + GC.start(immediate_sweep: true) + assert_equal true, GC.latest_gc_info(:immediate_sweep) + end + def test_count c = GC.count GC.start -- cgit v1.2.3