You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vladimir mentioned that he has seen something like this as newer thread implementations use pooling so that when the thread completes it is not necessary released.
You could try starting/stopping many threads (say 1000 times) and validate that after some number it does not show additional leaks.
We don't think this is related to node-addon-api at all, the same could outside an addon should report the same thing.
I used std::thread in the C++ addon code, and a memory leak is found using LeakTracer.
Here is my C++ addon code:
Then js code which invoke addon:
The backtrace of leak is :
leaktracer::MemoryTrace::registerAllocation(void*, unsigned long, bool);operator new(unsigned long);std::__1::thread::thread<demo::Method(napi_env__*, napi_callback_info__*)::$_0, void>(demo::Method(napi_env__*, napi_callback_info__*)::$_0&&);std::__1::thread::thread<demo::Method(napi_env__*, napi_callback_info__*)::$_0, void>(demo::Method(napi_env__*, napi_callback_info__*)::$_0&&);demo::Method(napi_env__*, napi_callback_info__*);(anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&);v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*);v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8;v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*)
I have tested on Windows10, Debian9, macOS10.15(Intel CPU) macOS11.3(M1), only macOS has leak.
Does anyone know why this is?
The text was updated successfully, but these errors were encountered: