denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97k stars 5.36k forks source link

Deno should try to trigger GC when the OS is low on memory #15128

Open andreubotella opened 2 years ago

andreubotella commented 2 years ago

V8 provides the v8::Isolate::low_memory_notification method, which is meant to let V8 know when the OS is running low on memory, so it can cause an aggressive, synchronous garbage collection. Currently Deno never calls this method, which can result in the OS killing the process when it's out of memory.

The question is when/how to know to call it.

bartlomieju commented 1 year ago

Another solution is to call Isolate::memory_pressure_notification(v8::MemoryPressureLevel::Moderate); outright