Whey method call into an instance fails after 100+ throws exception wihout Isolate::Scope isolate_scope(isolate)?

12 views
Skip to first unread message

Pankaj Chhabra

unread,
Jun 5, 2023, 8:57:56 PM6/5/23
to v8-dev
0

I have a DLL with init, deinit, start, stop, methodcall methods. There is only one isolate scope.In init, I register the platform

platformZ = platform::NewDefaultPlatform(); V8::InitializePlatform(platformZ.get()); V8::Initialize();

In start I create the isolate

// Create a new Isolate and make it the current one. isolate = Isolate::New(create_params); Isolate::Scope isolate_scope(isolate); // Create a stack-allocated handle scope. HandleScope handle_scope(isolate); .. Local<Context> context = Context::New(isolate, NULL, global); Context::Scope context_scope(context);

In methodCall, I find the instance of MyClass and call myMethod in it. If I don't call isolate_scope, the is a crash after making around 100 calls to myMethod, I get an exception 0xC0000005: Access violation writing location 0x00000000. When I call isolate_scope, the exception does not happen.

Isolate::Scope isolate_scope(isolate); // Go into the existing scope HandleScope handle_scope(isolate);

I don't exit the scope by any other instructor. Could someone please tell me why isolate_scope makes it work?. If I call Isolate::Scope isolate_scope(isolate), it does not fail even on making a million calls.


Reply all
Reply to author
Forward
0 new messages