From 30acc0d1dc56687eba133dce369aedeb504ebb33 Mon Sep 17 00:00:00 2001 From: Daeyeon Jeong Date: Fri, 6 Jun 2025 00:53:17 +0900 Subject: [PATCH] fix: revert commeted lock_gc_release Signed-off-by: Daeyeon Jeong --- src/api/isolate.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/api/isolate.cc b/src/api/isolate.cc index 76770a950f..03d1492d8f 100755 --- a/src/api/isolate.cc +++ b/src/api/isolate.cc @@ -283,8 +283,9 @@ IsolateWrap::IsolateWrap() { threadManager_ = new ThreadManager(); - // NOTE: check lock_gc_release(); is needed (and where) - // lock_gc_release(); + // The following ensures this instance is retained using PersistentHolder. + lock_gc_release(); + Memory::gcRegisterFinalizer(this, [](void* self) { reinterpret_cast(self)->~IsolateWrap(); }); @@ -320,8 +321,8 @@ IsolateWrap* IsolateWrap::New() { void IsolateWrap::Dispose() { LWNODE_CALL_TRACE_ID(ISOWRAP); LWNODE_CALL_TRACE_GC_START(); - // NOTE: check unlock_gc_release(); is needed (and where) - // unlock_gc_release(); + + unlock_gc_release(); global_handles()->dispose(); RegisteredExtension::unregisterAll(); @@ -394,6 +395,7 @@ void IsolateWrap::Initialize(const v8::Isolate::CreateParams& params) { // Do Nothing LWNODE_CALL_TRACE_GC_START(); // NOTE: Calls when vmInstance() is terminated. This happens before GC runs + LWNODE_DEV_LOG("[OnVMInstanceDelete]"); LWNODE_CALL_TRACE_GC_END(); });