Thanks Jakob.
Below is the backtrace. Here how can I identify, when I came out of event loop. Because, we want cleanup calls to get called quickly.
Backtrace:
V8_Fatal
0x5ac3ec3
v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const // calling javascript function here
// app code
v8::internal::GlobalHandles::PendingPhantomCallback::Invoke(v8::internal::Isolate*)
v8::internal::GlobalHandles::DispatchPendingPhantomCallbacks(bool)
v8::internal::GlobalHandles::PostGarbageCollectionProcessing(v8::internal::GarbageCollector, v8::GCCallbackFlags)
v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags)
v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags)
v8::internal::Factory::CopyFixedArrayAndGrow(v8::internal::Handle<v8::internal::FixedArray>, int, v8::internal::PretenureFlag)
v8::internal::ArrayList::EnsureSpace(v8::internal::Handle<v8::internal::ArrayList>, int)
v8::internal::ArrayList::Add(v8::internal::Handle<v8::internal::ArrayList>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::ArrayList::AddMode)
v8::internal::Heap::AddRetainedMap(v8::internal::Handle<v8::internal::Map>)
0x59d0eda
v8::internal::OptimizedCompileJob::GenerateCode() //DisAllowJavascriptExecutionScope set here
v8::internal::Compiler::FinalizeOptimizedCompileJob(v8::internal::OptimizedCompileJob*)
v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions()
v8::internal::Runtime_TryInstallOptimizedCode(int, v8::internal::Object**, v8::internal::Isolate*)
........................
We have many number of cleanup objects, for which we have to call JS code on it being garbage collected. So, we will have cleanup calls for every object being garbage collected. Could you please point the instant, at which it will be good to identify this operation is completed (i.e the point where JS enging completed its garbage collection operation and we are good to do cleanup).
Thanks.
Regards,
Madan