News for hackers. Stuff that matters.
Re:Dealing with Out-of-Memory Conditions in Rust by creata on Saturday August 14, 2021 @08:28PM (#28185169)
> I use https://lib.rs/cap which self-imposes memory limit on the process.

How do you choose that limit?

Re:Dealing with Out-of-Memory Conditions in Rust by pornel on Saturday August 14, 2021 @08:58PM (#28185318)
In 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`.