1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (add_heap_slots, init_heap): reset heaps_inc zero when

heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
  [ruby-core:39777] [Bug #5380]

* test/ruby/test_gc.rb (test_gc_parameter): add test for it.

* test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
  enable pass environemnt variables to child process.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2011-10-01 01:00:40 +00:00
parent 0003d051dd
commit 3d2451d996
4 changed files with 29 additions and 2 deletions

View file

@ -1,3 +1,14 @@
Sat Oct 1 09:48:53 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* gc.c (add_heap_slots, init_heap): reset heaps_inc zero when
heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
[ruby-core:39777] [Bug #5380]
* test/ruby/test_gc.rb (test_gc_parameter): add test for it.
* test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
enable pass environemnt variables to child process.
Thu Sep 29 13:17:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* array.c (ary_join_1): should not copy the encoding of non-string

2
gc.c
View file

@ -1090,6 +1090,7 @@ add_heap_slots(rb_objspace_t *objspace, size_t add)
for (i = 0; i < add; i++) {
assign_heap_slot(objspace);
}
heaps_inc = 0;
}
static void
@ -1106,7 +1107,6 @@ init_heap(rb_objspace_t *objspace)
}
#endif
heaps_inc = 0;
objspace->profile.invoke_time = getrusage_time();
finalizer_table = st_init_numtable();
}

View file

@ -122,7 +122,13 @@ module Test
module Assertions
public
def assert_normal_exit(testsrc, message = '', opt = {})
out, _, status = EnvUtil.invoke_ruby(%W'-W0', testsrc, true, :merge_to_stdout, opt)
if opt.include?(:child_env)
opt = opt.dup
child_env = [opt.delete(:child_env)] || []
else
child_env = []
end
out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, opt)
pid = status.pid
faildesc = proc do
signo = status.termsig

View file

@ -1,5 +1,7 @@
require 'test/unit'
require_relative "envutil"
class TestGc < Test::Unit::TestCase
class S
def initialize(a)
@ -78,4 +80,12 @@ class TestGc < Test::Unit::TestCase
ensure
GC.stress = prev_stress
end
def test_gc_parameter
env = {
"RUBY_GC_MALLOC_LIMIT" => "60000000",
"RUBY_HEAP_MIN_SLOTS" => "100000"
}
assert_normal_exit("1", "[ruby-core:39777]", :child_env => env)
end
end