diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-08 21:45:50 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-08 21:45:50 +0000 |
commit | 043047a8fd5315d98eac38ddbd04ebe8db361817 (patch) | |
tree | a64432e9eafa6ebe26b3fc8dd806a00c8051111c /insns.def | |
parent | 1a17766e6ab19181d7a471e4271eadf6eb42f33a (diff) | |
download | ruby-043047a8fd5315d98eac38ddbd04ebe8db361817.tar.gz |
thread_pthread.c: fix memory leak from fork loop leapfrog (v2)
Constantly forking a single-threaded process in a loop leads to
a memory leak when using POSIX timers.
v2: disarm before timer_delete
==> fork_leapfrog.rb <==
require 'io/wait'
Dir.chdir '/proc'
prev = 0
loop do
pid = fork
exit!(0) if pid
# show the number of 4K pages used (Linux-only)
n = File.read("#$$/statm").split(-' ')[1].to_i
if n > prev
puts "#{prev} => #{n}"
prev = n
end
# since Ctrl-C from a terminal can't stop this loop,
# allow the user to just hit any key to stop
break if STDIN.wait(0)
end
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
0 files changed, 0 insertions, 0 deletions