summaryrefslogtreecommitdiff
path: root/src/node_api.cc
diff options
context:
space:
mode:
authorChris Young <chris.young@gotinder.com>2017-06-27 20:56:15 -0700
committerMyles Borins <mylesborins@google.com>2018-04-16 17:46:05 -0400
commitac5b9048083156c8dba338e4973ff04f82dfa712 (patch)
treed9867686ea0225d22beb0437ff6d9932f51d5479 /src/node_api.cc
parent278a2d069f97e7fdff5892eefc98d85f38153c94 (diff)
downloadnode-new-ac5b9048083156c8dba338e4973ff04f82dfa712.tar.gz
n-api: adds function to adjust external memory
Added a wrapper around v8::Isolate::AdjustAmountOfExternalAllocatedMemory Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14310 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: https://github.com/nodejs/node/issues/13928
Diffstat (limited to 'src/node_api.cc')
-rw-r--r--src/node_api.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_api.cc b/src/node_api.cc
index fd31817e4a..a2322295fc 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -3216,6 +3216,19 @@ napi_status napi_get_node_version(napi_env env,
return napi_clear_last_error(env);
}
+napi_status napi_adjust_external_memory(napi_env env,
+ int64_t change_in_bytes,
+ int64_t* adjusted_value) {
+ CHECK_ENV(env);
+ CHECK_ARG(env, &change_in_bytes);
+ CHECK_ARG(env, adjusted_value);
+
+ *adjusted_value = env->isolate->AdjustAmountOfExternalAllocatedMemory(
+ change_in_bytes);
+
+ return napi_clear_last_error(env);
+}
+
namespace uvimpl {
static napi_status ConvertUVErrorCode(int code) {