diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-08 19:25:37 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-12-08 19:25:37 +0000 |
commit | 2b1dcc1dd1eb260fd20ff1e6e0dfb0e5624a3cc6 (patch) | |
tree | 5da68d30a828638d4aeac9b299d9ccdf0c52601c /doc/NEWS-2.5.0 | |
parent | 726ea30ac2882a875610c44ab8f6cc7f25bc4e8c (diff) | |
download | ruby-2b1dcc1dd1eb260fd20ff1e6e0dfb0e5624a3cc6.tar.gz |
thread_pthread.c: fix memory leak from fork loop leapfrog
Constantly forking a single-threaded process in a loop leads to
a memory leak when using POSIX timers.
==> 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@66288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc/NEWS-2.5.0')
0 files changed, 0 insertions, 0 deletions