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 3146ba1
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 in 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 3146ba1

Please sign in to comment.