Re:Dealing with Out-of-Memory Conditions in Rust
by tooltower on Saturday August 14, 2021 @11:19AM
(#28181314)
Of course, it's not a guarantee. But if your program is under heavy pressure from other programs, it won't continue to run in any reasonable sense either, even without Linux's OOM-killer. Yes, you can show an error message, but then the only safe thing to do is quit. You won't even be able to clean up any on-disk swap files properly, let alone handle user interactions.
Handling this is hard in desktop applications. For servers, you can have known workloads with better limits on each process.
It's takes very little memory to show the user an error message it will almost always succeed even if the operation that triggered failed due to OOM.