ruby-changes:48584
From: ko1 <ko1@a...>
Date: Tue, 7 Nov 2017 23:24:04 +0900 (JST)
Subject: [ruby-changes:48584] ko1:r60699 (trunk): disable GC.
ko1 2017-11-07 23:23:58 +0900 (Tue, 07 Nov 2017) New Revision: 60699 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60699 Log: disable GC. * test/ruby/test_io.rb (test_write_no_garbage): malloc can cause GC and it will reduce string object counts. So disable GC during this test. Modified files: trunk/test/ruby/test_io.rb Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 60698) +++ test/ruby/test_io.rb (revision 60699) @@ -3651,10 +3651,15 @@ __END__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_io.rb#L3651 ObjectSpace.count_objects(res) # creates strings on first call [ 'foo'.b, '*' * 24 ].each do |buf| with_pipe do |r, w| - before = ObjectSpace.count_objects(res)[:T_STRING] - n = w.write(buf) - s = w.syswrite(buf) - after = ObjectSpace.count_objects(res)[:T_STRING] + GC.disable + begin + before = ObjectSpace.count_objects(res)[:T_STRING] + n = w.write(buf) + s = w.syswrite(buf) + after = ObjectSpace.count_objects(res)[:T_STRING] + ensure + GC.enable + end assert_equal before, after, "no strings left over after write [ruby-core:78898] [Bug #13085]: #{ before } strings before write -> #{ after } strings after write" assert_not_predicate buf, :frozen?, 'no inadvertent freeze' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/