[前][次][番号順一覧][スレッド一覧]

ruby-changes:36066

From: normal <ko1@a...>
Date: Mon, 27 Oct 2014 11:34:09 +0900 (JST)
Subject: [ruby-changes:36066] normal:r48147 (trunk): test/ruby/test_process.rb: reduce garbage during forks

normal	2014-10-27 11:33:51 +0900 (Mon, 27 Oct 2014)

  New Revision: 48147

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48147

  Log:
    test/ruby/test_process.rb: reduce garbage during forks
    
    * test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
      reduce garbage during forks
    
    This seems to reduce failures on my memory-constrained VM
    when doing a full test-all.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_process.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48146)
+++ ChangeLog	(revision 48147)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Oct 27 11:18:32 2014  Eric Wong  <e@8...>
+
+	* test/ruby/test_process.rb (test_deadlock_by_signal_at_forking):
+	  reduce garbage during forks
+
 Sun Oct 25 12:26:26 2014  Martin Duerst <duerst@i...>
 
 	* template/insns.inc.tmpl, insns_info.inc.tmpl, known_errors.inc.tmpl,
Index: test/ruby/test_process.rb
===================================================================
--- test/ruby/test_process.rb	(revision 48146)
+++ test/ruby/test_process.rb	(revision 48147)
@@ -1919,18 +1919,21 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1919
   end
 
   def test_deadlock_by_signal_at_forking
+    GC.start # reduce garbage
+    buf = ''
     ruby = EnvUtil.rubybin
     er, ew = IO.pipe
-    unless runner = IO.popen("-")
+    unless runner = IO.popen("-".freeze)
       er.close
       status = true
+      GC.disable # avoid triggering CoW after forks
       begin
         $stderr.reopen($stdout)
         trap(:QUIT) {}
         parent = $$
         100.times do |i|
           pid = fork {Process.kill(:QUIT, parent)}
-          IO.popen(ruby, 'r+'){}
+          IO.popen(ruby, 'r+'.freeze){}
           Process.wait(pid)
           $stdout.puts
           $stdout.flush
@@ -1948,7 +1951,7 @@ EOS https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1951
     begin
       loop do
         runner.wait_readable(5)
-        runner.read_nonblock(100)
+        runner.read_nonblock(100, buf)
       end
     rescue EOFError => e
       _, status = Process.wait2(runner.pid)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]