From 618e642bc34d2bfb5570943ac620763505860994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerhard=20St=C3=B6bich?= <18708370+Flarna@users.noreply.github.com> Date: Fri, 10 Sep 2021 20:31:33 +0200 Subject: [PATCH] doc: clarify that ObjectWrap requires manual cleanup on shutdown Clarify that ObjectWrap instances are not destroyed on process or worker shutdown and require manual destruction to avoid resource leaks. --- doc/api/addons.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/addons.md b/doc/api/addons.md index 233fb332f4976a..a898a190a7c748 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -965,6 +965,10 @@ provided by the underlying V8 JavaScript engine. They are subject to change or removal at any time. They are not documented by Node.js or V8, and they should never be used outside of testing. +Note that during shutdown of the process or worker threads destructors are not +called by the JS engine. Therefore it's in the responsibility of the user to +monitor these objects and ensure proper destruction and avoid resource leaks. + ### Factory of wrapped objects Alternatively, it is possible to use a factory pattern to avoid explicitly