aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-02 00:50:42 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-02 00:50:42 +0000
commit657dffe0e736c08941c8c6a8a6290240637ee3fe (patch)
tree9c4b43d074f0ac3382e78c67628acbfd345ffd40 /cont.c
parentc503093b129028cce7dc7097b9cac2e9e186c171 (diff)
downloadruby-657dffe0e736c08941c8c6a8a6290240637ee3fe.tar.gz
release VM stack properly.
* cont.c: r55766 change the handling method of Fiber's VM stack. Resumed Fiber points NULL as VM stack and running Thread has responsibility to manage it (marking and releasing). However, thread_start_func_2()@thread.c and thread_free()@vm.c doesn't free the VM stack if corresponding root Fiber is exist. This causes memory leak. [Bug #13772] * cont.c (root_fiber_alloc): fib->cont.saved_thread.ec.stack should be NULL because running thread has responsibility to manage this stack. * vm.c (rb_thread_recycle_stack_release): assert given stack is not NULL (callers should care it). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index 095cc86767..a43950c6cb 100644
--- a/cont.c
+++ b/cont.c
@@ -1288,6 +1288,7 @@ root_fiber_alloc(rb_thread_t *th)
rb_fiber_t *fib;
/* no need to allocate vm stack */
fib = fiber_t_alloc(fiber_alloc(rb_cFiber));
+ fib->cont.saved_thread.ec.stack = NULL;
fib->cont.type = ROOT_FIBER_CONTEXT;
#if FIBER_USE_NATIVE
#ifdef _WIN32