File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,10 @@ void v8__Isolate__LowMemoryNotification(v8::Isolate* self) {
397397 self->LowMemoryNotification ();
398398}
399399
400+ void v8__Isolate__MemoryPressureNotification (v8::Isolate* self, v8::MemoryPressureLevel level) {
401+ self->MemoryPressureNotification (level);
402+ }
403+
400404void v8__Isolate__GetHeapStatistics (
401405 v8::Isolate* self,
402406 v8::HeapStatistics* stats) {
Original file line number Diff line number Diff line change @@ -260,6 +260,12 @@ void v8__Isolate__TerminateExecution(Isolate* self);
260260bool v8__Isolate__IsExecutionTerminating (Isolate * self );
261261void v8__Isolate__CancelTerminateExecution (Isolate * self );
262262void v8__Isolate__LowMemoryNotification (Isolate * self );
263+ typedef enum MemoryPressureLevel {
264+ kNone = 0 ,
265+ kModerate = 1 ,
266+ kCritical = 2
267+ } MemoryPressureLevel ;
268+ void v8__Isolate__MemoryPressureNotification (Isolate * self , MemoryPressureLevel level );
263269typedef struct HeapStatistics {
264270 size_t total_heap_size ;
265271 size_t total_heap_size_executable ;
Original file line number Diff line number Diff line change @@ -400,6 +400,16 @@ pub const Isolate = struct {
400400 c .v8__Isolate__LowMemoryNotification (self .handle );
401401 }
402402
403+ pub const MemoryPressureLevel = enum (u32 ) {
404+ none = c .kNone ,
405+ moderate = c .kModerate ,
406+ critical = c .kCritical ,
407+ };
408+
409+ pub fn memoryPressureNotification (self : Self , level : MemoryPressureLevel ) void {
410+ c .v8__Isolate__MemoryPressureNotification (self .handle , @intFromEnum (level ));
411+ }
412+
403413 pub fn getHeapStatistics (self : Self ) c.HeapStatistics {
404414 var res : c.HeapStatistics = undefined ;
405415 c .v8__Isolate__GetHeapStatistics (self .handle , & res );
You can’t perform that action at this time.
0 commit comments