[ruby-cvs:70975] normal:r63884 (trunk): mjit: get rid of memory leak in pause+resume loop
normal at ruby-lang.org
normal at ruby-lang.org
Sun Jul 8 16:27:24 JST 2018
normal 2018-07-08 16:27:24 +0900 (Sun, 08 Jul 2018)
New Revision: 63884
https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63884
Log:
mjit: get rid of memory leak in pause+resume loop
pthread_atfork is not idempotent and repeatedly calling it
causes it to register the same hook repeatedly; leading to
unbound memory growth.
Ruby already has a (confusing-named) internal API for to call
in the forked child process: rb_thread_atfork
Call the MJIT child_after_fork hook inside that to prevent
unbound growth with the following loop:
loop do
RubyVM::MJIT.pause
RubyVM::MJIT.resume
end
Modified files:
trunk/mjit.c
trunk/thread.c
trunk/thread_pthread.c
trunk/thread_win32.c
More information about the ruby-cvs
mailing list