mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
src,deps: add ABI safe use of CheckMemoryPressure
CheckMemoryPressure cannot be used ABI-safely from v8.h. Add a alternate implementation of AdjustAmountOfExternalAllocatedMemory and then use that from Node. PR-URL: https://github.com/nodejs/node/pull/24499 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Myles Borins <myles.borins@gmail.com>
This commit is contained in:
1 parent
5245d6ac97
commit
0157e3ebca
11 files changed
+60
-17
No files matched your search
+2
-2
@@ -66,7 +66,7 @@ class ExternString: public ResourceType {
|
||||
public:
|
||||
~ExternString() override {
|
||||
free(const_cast<TypeName*>(data_));
|
||||
isolate()->AdjustAmountOfExternalAllocatedMemory(-byte_length());
|
||||
isolate()->AdjustAmountOfExternalAllocatedMemoryCustom(-byte_length());
|
||||
}
|
||||
|
||||
const TypeName* data() const override {
|
||||
@@ -122,7 +122,7 @@ class ExternString: public ResourceType {
|
||||
data,
|
||||
length);
|
||||
MaybeLocal<Value> str = NewExternal(isolate, h_str);
|
||||
isolate->AdjustAmountOfExternalAllocatedMemory(h_str->byte_length());
|
||||
isolate->AdjustAmountOfExternalAllocatedMemoryCustom(h_str->byte_length());
|
||||
|
||||
if (str.IsEmpty()) {
|
||||
delete h_str;
|
||||
|
||||
Reference in new issue
Block a user