You have to be IN an isolate in order to dispose another Isolate.
On Wednesday, March 26, 2014 6:15:42 AM UTC-7, Kevin Ingwersen wrote:
>
> Hey.
>
> I am getting somewhat confused currently. So, I have been trying out how
> to properly dispose an isolate. But whatever I try, I get an error. If I
> dispose the isolate, I get
>
> #
> # Fatal error in ../../deps/v8/src/isolate.h, line 456
> # CHECK(isolate != __null) failed
> #
>
> But if I dont do that, then…
>
> FATAL ERROR: v8::V8::Dispose() Use v8::Isolate::Dispose() for non-default
> isolate.
> Abort trap: 6
>
> I am gonna try to sumarize the code I am working with:
>
> // -> main
> v8::Isolate* isl = v8::Isolate::New();
> isl->Enter();
>
> node::Start(Args.arg_c, Args.arg_v);
>
> // -> node::Start
> int code;
> V8::Initialize();
> {
> Locker locker(node_isolate);
> Environment* env =
> CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
> // This Context::Scope is here so EnableDebug() can look up the
> current
> // environment with Environment::GetCurrentChecked().
> // TODO(bnoordhuis) Reorder the debugger initialization logic so it
> can
> // be removed.
> {
> Context::Scope context_scope(env->context());
> bool more;
> do {
> more = uv_run(env->event_loop(), UV_RUN_ONCE);
> if (more == false) {
> EmitBeforeExit(env);
>
> // Emit `beforeExit` if the loop became alive either after
> emitting
> // event, or after running some callbacks.
> more = uv_loop_alive(env->event_loop());
> if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
> more = true;
> }
> } while (more == true);
> code = EmitExit(env);
> RunAtExit(env);
> }
> env->Dispose();
> env = NULL;
> }
>
> // -> back to main
> v8::V8::Dispose();
>
>
> Environment holds a pointer to the v8::Isolate. the Dispose() method is
> quite simple:
>
> Environment::Dispose() {
> delete this;
> }
>
> So what is going wrong here o-o? I am loosing a bit of an overview right
> now.
>
> Kind regards, Ingwie
> Am 26.03.2014 um 08:36 schrieb Ben Noordhuis
> <[email protected]<javascript:>>:
>
>
> > On Wed, Mar 26, 2014 at 1:05 AM, Kevin Ingwersen
> > <[email protected] <javascript:>> wrote:
> >> Hey.
> >>
> >> When I create a custom isolate, and then call V8::Dispose(), I get a
> big error:
> >>
> >> #
> >> # Fatal error in ../../deps/v8/src/isolate.h, line 456
> >> # CHECK(isolate != __null) failed
> >> #
> >>
> >> ==== C stack trace ===============================
> >>
> >> 1: ??
> >> 2: ??
> >> 3: ??
> >> 4: ??
> >> 5: ??
> >> 6: ??
> >> 7: ??
> >> 8: ??
> >> Process 24211 stopped
> >> * thread #2: tid = 0x3d7156, 0x0000000100836755
> node`v8::internal::OS::DebugBreak() + 5 at platform-posix.cc:294, stop
> reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
> >> frame #0: 0x0000000100836755 node`v8::internal::OS::DebugBreak() + 5
> at platform-posix.cc:294
> >> 291 #else
> >> 292 #error Unsupported host architecture.
> >> 293 #endif
> >> -> 294 }
> >> 295
> >> 296
> >> 297 //
> ----------------------------------------------------------------------------
>
> >>
> >> I am initializing my isolate with:
> >>
> >> v8::Isolate *isl = v8::Isolate::New();
> >> isl->Enter();
> >>
> >> Then the code runs, and at the bottom:
> >>
> >> node_isolate->Exit();
> >> node_isolate->Dispose();
> >>
> >> A while after is the V8::Dispose(). When i comment this call out, the
> programm exits just as I expected. Otherwise, it crashes with the posted
> bunch above. What is the reason for this?
> >>
> >> Kind regards, Ingwie.
> >
> > There is still something that uses the isolate. Make sure you use
> > proper scoping in your C++ code, i.e.:
> >
> > CHECK(V8::Initialize() == true);
> > Isolate* isolate = Isolate::New();
> > {
> > Isolate::Scope isolate_scope(isolate);
> > HandleScope handle_scope(isolate);
> > Local<Context> = Context::New(...);
> > CHECK(context.IsEmpty() == false);
> > {
> > Context::Scope context_scope(context);
> > // etc.
> > }
> > }
> > CHECK(V8::Dispose() == true);
>
>
>
>
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.