diff options
author | isurusiri <isuruanatomy@gmail.com> | 2018-04-30 19:13:29 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-09-19 08:58:01 +0300 |
commit | a1381fab8a1a35b3af9cf1cfb2f40b3a6f28eb5c (patch) | |
tree | cbe979beaf5d9f24d30a3c82938dac8d3f301a85 /doc/api/addons.md | |
parent | e6d0ced7bbe9f48aa1e4e30be8f88b1db0235a62 (diff) |
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: https://github.com/nodejs/node/issues/19876
PR-URL: https://github.com/nodejs/node/pull/20431
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Diffstat (limited to 'doc/api/addons.md')
-rw-r--r-- | doc/api/addons.md | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/api/addons.md b/doc/api/addons.md index 483f2ad27d7..5e06336a85a 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -848,6 +848,13 @@ console.log(obj.plusOne()); // Prints: 13 ``` +The destructor for a wrapper object will run when the object is +garbage-collected. For destructor testing, there are command-line flags that +can be used to make it possible to force garbage collection. These flags are +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. + ### Factory of wrapped objects Alternatively, it is possible to use a factory pattern to avoid explicitly |