Skip to content

Commit

Permalink
doc: clarify that ObjectWrap requires manual cleanup on shutdown
Browse files Browse the repository at this point in the history
Clarify that ObjectWrap instances are not destroyed on process or
worker shutdown and require manual destruction to avoid resource
leaks.
  • Loading branch information
Flarna committed Sep 10, 2021
1 parent 00ca848 commit 618e642
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/addons.md
Expand Up @@ -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
Expand Down

0 comments on commit 618e642

Please sign in to comment.