diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-19 06:00:46 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-19 06:00:46 +0000 |
commit | 56b6eed32320c4793ee105d5bf23041804d0a0e3 (patch) | |
tree | 2cd241ea539e0dcb3620069a4f2942b431abcb0b /test/ruby/test_gc.rb | |
parent | 879ac9dec2ccb6a006ae6aa075110f6a8946547c (diff) |
merge revision(s) 45021,45022,45028: [Backport #9524]
* gc.c: introduce new environment variable
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" to control major/minor GC
frequency.
Do full GC when the number of old objects is more than R * N
where R is this factor and
* test/ruby/test_gc.rb: add a test.
* gc.c (get_envparam_double): fix a warning message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_gc.rb')
-rw-r--r-- | test/ruby/test_gc.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 7c13978dc1..c644aa5d9a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -177,6 +177,16 @@ class TestGc < Test::Unit::TestCase assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_GROWTH_FACTOR=2.0/, "") assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_GROWTH_MAX_SLOTS=10000/, "[ruby-core:57928]") + env = { + "RUBY_GC_HEAP_INIT_SLOTS" => "100000", + "RUBY_GC_HEAP_FREE_SLOTS" => "10000", + "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" => "0.9", + } + assert_normal_exit("exit", "", :child_env => env) + assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=0\.9/, "") + # always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0 + assert_in_out_err([env, "-e", "1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "") + # check obsolete assert_in_out_err([{'RUBY_FREE_MIN' => '100'}, '-w', '-eexit'], '', [], /RUBY_FREE_MIN is obsolete. Use RUBY_GC_HEAP_FREE_SLOTS instead/) |