- Version: node-chakracore-v10.13.0
- Platform: Darwin 18.7.0 x86_64
- Subsystem: chakrashim
In deps/chakrashim/src/jsrtisolateshim.cc there is a statement CHAKRA-TODO: This is not called after cross context work in chakra. Fix this else we will leak chakrashim object.
JsContextBeforeCollectCallback is never called, so ContextShim, saved as void* data in JSContextRef is leaking.
The problem is in deps/chakrashim/src/inspector/inspected-context.cc.
As far as I understand from deps/chakrashim/core/lib/Common/Memory/Recycler.cpp Recycler::SetObjectBeforeCollectCallback we only allow 1 callback per object.
We configure required callback in IsolateShim::NewContext after ContextShim creation and then, when inspector starts in src/node.cc bool StartInspector(Environment* env, const char* script_path, std::shared_ptr<DebugOptions> options) it needs to set a weak reference with callback for our context deps/chakrashim/src/inspector/inspected-context.cc m_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackType::kParameter);. As a result the required JsContextBeforeCollectCallback is being lost.
After compiling node-chakracore setting --without-inspector flag JsContextBeforeCollectCallback is being called duringJsDisposeRuntime.
I'm new to node-chakracore, so I don't know how to fix the issue properly. But this info could be useful for you guys.
In deps/chakrashim/src/jsrtisolateshim.cc there is a statement CHAKRA-TODO: This is not called after cross context work in chakra. Fix this else we will leak chakrashim object.
JsContextBeforeCollectCallbackis never called, soContextShim, saved asvoid*data inJSContextRefis leaking.The problem is in deps/chakrashim/src/inspector/inspected-context.cc.
As far as I understand from deps/chakrashim/core/lib/Common/Memory/Recycler.cpp
Recycler::SetObjectBeforeCollectCallbackwe only allow 1 callback per object.We configure required callback in
IsolateShim::NewContextafterContextShimcreation and then, when inspector starts in src/node.ccbool StartInspector(Environment* env, const char* script_path, std::shared_ptr<DebugOptions> options)it needs to set a weak reference with callback for our context deps/chakrashim/src/inspector/inspected-context.ccm_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackType::kParameter);. As a result the requiredJsContextBeforeCollectCallbackis being lost.After compiling node-chakracore setting
--without-inspectorflagJsContextBeforeCollectCallbackis being called duringJsDisposeRuntime.I'm new to node-chakracore, so I don't know how to fix the issue properly. But this info could be useful for you guys.