Skip to content

Commit

Permalink
Avoid leaking orphaned VM instances.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brixen committed Mar 27, 2016
1 parent 4c0c5b4 commit 045796e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions machine/builtin/thread.cpp
Expand Up @@ -156,6 +156,7 @@ namespace rubinius {
call_frame->line(state));

if(!thread->send(state, state->symbol("initialize"), args, block, true)) {
thread->vm()->set_zombie(state);
return NULL;
}

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

if(!thread->send(state, state->symbol("__thread_initialize__"), args, block, true)) {
thread->vm()->set_zombie(state);
return NULL;
}

Expand Down

0 comments on commit 045796e

Please sign in to comment.