diff --git a/src/node.cc b/src/node.cc index a382e86acc3..447d5f7ac5d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3082,7 +3082,7 @@ int Start(int argc, char *argv[]) { HandleScope handle_scope(node_isolate); // Create the one and only Context. - Persistent context = Context::New(); + Local context = Context::New(node_isolate); Context::Scope context_scope(context); // Use original argv, as we're just copying values out of it. @@ -3102,10 +3102,6 @@ int Start(int argc, char *argv[]) { EmitExit(process_l); RunAtExit(); - -#ifndef NDEBUG - context.Dispose(node_isolate); -#endif } #ifndef NDEBUG diff --git a/src/node_script.cc b/src/node_script.cc index 21e169d9d37..65561ae4828 100644 --- a/src/node_script.cc +++ b/src/node_script.cc @@ -165,7 +165,7 @@ Handle WrappedContext::New(const Arguments& args) { WrappedContext::WrappedContext() : ObjectWrap() { - context_ = Context::New(); + context_ = Persistent::New(node_isolate, Context::New(node_isolate)); } @@ -386,9 +386,7 @@ Handle WrappedScript::EvalMachine(const Arguments& args) { // function. Here we grab a temporary handle to the new context, assign it // to a local handle, and then dispose the persistent handle. This ensures // that when this function exits the context will be disposed. - Persistent tmp = Context::New(); - context = Local::New(node_isolate, tmp); - tmp.Dispose(node_isolate); + context = Context::New(node_isolate); } else if (context_flag == userContext) { // Use the passed in context