mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-01-22 23:20:03 -05:00
Add v8::Isolate:AdjustAmountOfExternalAllocatedMemory bindings (#880)
This commit is contained in:
parent
e7e8ada2be
commit
4b5514711a
2 changed files with 25 additions and 0 deletions
|
@ -281,6 +281,11 @@ void v8__Isolate__RemoveNearHeapLimitCallback(
|
||||||
isolate->RemoveNearHeapLimitCallback(callback, heap_limit);
|
isolate->RemoveNearHeapLimitCallback(callback, heap_limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t v8__Isolate__AdjustAmountOfExternalAllocatedMemory(
|
||||||
|
v8::Isolate* isolate, int64_t change_in_bytes) {
|
||||||
|
return isolate->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
void v8__Isolate__SetOOMErrorHandler(v8::Isolate* isolate,
|
void v8__Isolate__SetOOMErrorHandler(v8::Isolate* isolate,
|
||||||
v8::OOMErrorCallback callback) {
|
v8::OOMErrorCallback callback) {
|
||||||
isolate->SetOOMErrorHandler(callback);
|
isolate->SetOOMErrorHandler(callback);
|
||||||
|
|
|
@ -194,6 +194,10 @@ extern "C" {
|
||||||
isolate: *mut Isolate,
|
isolate: *mut Isolate,
|
||||||
callback: OomErrorCallback,
|
callback: OomErrorCallback,
|
||||||
);
|
);
|
||||||
|
fn v8__Isolate__AdjustAmountOfExternalAllocatedMemory(
|
||||||
|
isolate: *mut Isolate,
|
||||||
|
change_in_bytes: i64,
|
||||||
|
) -> i64;
|
||||||
fn v8__Isolate__SetPrepareStackTraceCallback(
|
fn v8__Isolate__SetPrepareStackTraceCallback(
|
||||||
isolate: *mut Isolate,
|
isolate: *mut Isolate,
|
||||||
callback: PrepareStackTraceCallback,
|
callback: PrepareStackTraceCallback,
|
||||||
|
@ -610,6 +614,22 @@ impl Isolate {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Adjusts the amount of registered external memory. Used to give V8 an
|
||||||
|
/// indication of the amount of externally allocated memory that is kept
|
||||||
|
/// alive by JavaScript objects. V8 uses this to decide when to perform
|
||||||
|
/// global garbage collections. Registering externally allocated memory
|
||||||
|
/// will trigger global garbage collections more often than it would
|
||||||
|
/// otherwise in an attempt to garbage collect the JavaScript objects
|
||||||
|
/// that keep the externally allocated memory alive.
|
||||||
|
pub fn adjust_amount_of_external_allocated_memory(
|
||||||
|
&mut self,
|
||||||
|
change_in_bytes: i64,
|
||||||
|
) -> i64 {
|
||||||
|
unsafe {
|
||||||
|
v8__Isolate__AdjustAmountOfExternalAllocatedMemory(self, change_in_bytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_oom_error_handler(&mut self, callback: OomErrorCallback) {
|
pub fn set_oom_error_handler(&mut self, callback: OomErrorCallback) {
|
||||||
unsafe { v8__Isolate__SetOOMErrorHandler(self, callback) };
|
unsafe { v8__Isolate__SetOOMErrorHandler(self, callback) };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue