Skip to content

Commit 045796e

Browse files
committedMar 27, 2016
Avoid leaking orphaned VM instances.
When starting a Thread, there is a point where resources are created but an exception could be raised that would result in the resources not getting reclaimed. At the moment, this is the VM instance. This will be refactored soon, but the same caution will always apply to creating Thread instances.
1 parent 4c0c5b4 commit 045796e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed
 

Diff for: ‎machine/builtin/thread.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ namespace rubinius {
156156
call_frame->line(state));
157157

158158
if(!thread->send(state, state->symbol("initialize"), args, block, true)) {
159+
thread->vm()->set_zombie(state);
159160
return NULL;
160161
}
161162

@@ -175,6 +176,7 @@ namespace rubinius {
175176
call_frame->line(state));
176177

177178
if(!thread->send(state, state->symbol("__thread_initialize__"), args, block, true)) {
179+
thread->vm()->set_zombie(state);
178180
return NULL;
179181
}
180182

0 commit comments

Comments
 (0)
Please sign in to comment.