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.

PR-URL: #40074
Fixes: #38816
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Flarna authored and nodejs-github-bot committed Sep 15, 2021
1 parent 8468bdb commit 7b4e6d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/addons.md
Original file line number Diff line number Diff line change
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.

During shutdown of the process or worker threads destructors are not called
by the JS engine. Therefore it's the responsibility of the user to track
these objects and ensure proper destruction to 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 7b4e6d4

Please sign in to comment.