diff options
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/n-api.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 12aad7583f..9c56e50e83 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -3394,6 +3394,31 @@ support it: * If the function is not available, provide an alternate implementation that does not use the function. +## Memory Management + +### napi_adjust_external_memory +<!-- YAML +added: REPLACEME +--> +```C +NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, + int64_t change_in_bytes, + int64_t* result); +``` + +- `[in] env`: The environment that the API is invoked under. +- `[in] change_in_bytes`: The change in externally allocated memory that is +kept alive by JavaScript objects. +- `[out] result`: The adjusted value + +Returns `napi_ok` if the API succeeded. + +This function gives V8 an indication of the amount of externally allocated +memory that is kept alive by JavaScript objects (i.e. a JavaScript object +that points to its own memory allocated by a native module). Registering +externally allocated memory will trigger global garbage collections more +often than it would otherwise. + <!-- it's very convenient to have all the anchors indexed --> <!--lint disable no-unused-definitions remark-lint--> ## Promises |