Skip to content

Commit 6ed5845

Browse files
isurusiritargos
authored andcommitted
doc: explain how to invoke gc
Currently the documentation for Wrapping C++ Objects doesn't explain how to destruct an object by explicitly invoking the garbage collector. This commit includes a modification to docs that explains how to force the garbage collector to clear objects using V8's command line flags. Fixes: #19876 PR-URL: #20431 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yang Guo <[email protected]>
1 parent 6367349 commit 6ed5845

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/addons.md

+7
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,13 @@ console.log(obj.plusOne());
848848
// Prints: 13
849849
```
850850

851+
The destructor for a wrapper object will run when the object is
852+
garbage-collected. For destructor testing, there are command-line flags that
853+
can be used to make it possible to force garbage collection. These flags are
854+
provided by the underlying V8 JavaScript engine. They are subject to change
855+
or removal at any time. They are not documented by Node.js or V8, and they
856+
should never be used outside of testing.
857+
851858
### Factory of wrapped objects
852859

853860
Alternatively, it is possible to use a factory pattern to avoid explicitly

0 commit comments

Comments
 (0)