3 ms·
It's bonkers to allow programs to destabilize the whole machine to the point that the kernel has to start killing off processes just to survive. I use https://
by pornel 5y ago
It's bonkers to allow programs to destabilize the whole machine to the point that the kernel has to start killing off processes just to survive.
I use https://lib.rs/cap https://lib.rs/cap which self-imposes memory limit on the process. Setting that limit below cgroup limit allows programs to actually handle OOM before they get killed by the OS (if only Rust's libstd wasn't so eager to self-abort anyway).
- creata 5y ago> I use https://lib.rs/cap https://lib.rs/cap which self-imposes memory limit on the process. How do you choose that limit?
- pornel 5y agoIn case of servers/vm/containers you probably know how much RAM you've provisioned, so set it to that minus whatever other processes need to live. For desktop applications it's tough. It may be just an arbitrarily high amount you don't expect to hit during normal operation. If you need to work with variable-size data, then it could be `size_of_file_being_opened * x` if you can predict the `x`.