@@ -216,6 +216,11 @@ static void GetConstrainedMemory(const FunctionCallbackInfo<Value>& args) {
216
216
}
217
217
}
218
218
219
+ static void GetAvailableMemory (const FunctionCallbackInfo<Value>& args) {
220
+ uint64_t value = uv_get_available_memory ();
221
+ args.GetReturnValue ().Set (static_cast <double >(value));
222
+ }
223
+
219
224
void RawDebug (const FunctionCallbackInfo<Value>& args) {
220
225
CHECK (args.Length () == 1 && args[0 ]->IsString () &&
221
226
" must be called with a single string" );
@@ -633,6 +638,7 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
633
638
SetMethod (isolate, target, " umask" , Umask);
634
639
SetMethod (isolate, target, " memoryUsage" , MemoryUsage);
635
640
SetMethod (isolate, target, " constrainedMemory" , GetConstrainedMemory);
641
+ SetMethod (isolate, target, " availableMemory" , GetAvailableMemory);
636
642
SetMethod (isolate, target, " rss" , Rss);
637
643
SetMethod (isolate, target, " cpuUsage" , CPUUsage);
638
644
SetMethod (isolate, target, " resourceUsage" , ResourceUsage);
@@ -674,6 +680,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
674
680
registry->Register (RawDebug);
675
681
registry->Register (MemoryUsage);
676
682
registry->Register (GetConstrainedMemory);
683
+ registry->Register (GetAvailableMemory);
677
684
registry->Register (Rss);
678
685
registry->Register (CPUUsage);
679
686
registry->Register (ResourceUsage);
0 commit comments