summaryrefslogtreecommitdiff
path: root/thread_win32.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 07:27:24 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 07:27:24 +0000
commitc93adfc170079a54965e939a5a4d57139cd714e1 (patch)
treefccf7a5a80e337ef710f0516b5f59a0bddc7f2ce /thread_win32.c
parenta1e589498d1b80e3bc8b3e8c5c07874afcf0cb17 (diff)
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_win32.c')
-rw-r--r--thread_win32.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/thread_win32.c b/thread_win32.c
index 3c6d0e7369..2d5eac1ff4 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -790,7 +790,7 @@ mjit_worker(void *arg)
/* Launch MJIT thread. Returns FALSE if it fails to create thread. */
int
-rb_thread_create_mjit_thread(void (*child_hook)(void), void (*worker_func)(void))
+rb_thread_create_mjit_thread(void (*worker_func)(void))
{
size_t stack_size = 4 * 1024; /* 4KB is the minimum commit size */
HANDLE thread_id = w32_create_thread(stack_size, mjit_worker, worker_func);