diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-04 22:58:08 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-04 22:58:08 +0000 |
commit | 80e973f0e61a843f9e76c280fce327e070da7dab (patch) | |
tree | 3f4d6a6fbcb203090c5cd20d2f54aa953e49ad6e /test/ruby/test_thread.rb | |
parent | 291a82f748de56e65fac10edefc51ec7a54a82d4 (diff) |
test/ruby/test_thread.rb (test_thread_interrupt_for_killed_thread): conserve resources
Use Thread.pass to let the sub-thread finish. This should avoid
running out of memory on resource-constrained systems.
(We don't want to use Thread#join to hit the exception)
This results in a significant memory usage reduction in this test:
make test-all TESTS='../test/ruby/test_thread.rb -v -n test_thread_interrupt_for_killed_thread'
Before:
3.46user 2.02system 0:05.29elapsed 103%CPU (0avgtext+0avgdata 88672maxresident)k
0inputs+0outputs (0major+143071minor)pagefaults 0swaps
After:
3.40user 1.83system 0:05.20elapsed 100%CPU (0avgtext+0avgdata 9368maxresident)k
0inputs+0outputs (0major+3059minor)pagefaults 0swaps
cf. https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180803T231706Z.fail.html.gz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_thread.rb')
-rw-r--r-- | test/ruby/test_thread.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index eb08a22ef7..03fd1e3075 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -1297,6 +1297,7 @@ q.pop while true t = Thread.new{sleep 0} t.raise Interrupt + Thread.pass # allow t to finish end _end end |