Re:Dealing with Out-of-Memory Conditions in Rust
by superjan on Saturday August 14, 2021 @07:01AM
(#28179707)
Why not budget how much memory your rust component needs, and allocate a pool ahead of time? This is how it’s sometimes done in embedded systems. It depends on what your rust code does of course, but if it’s runtime memory use depends on untrusted data it is handling that is a concern in itself.
[ Parent
| on HN ]
Re:Dealing with Out-of-Memory Conditions in Rust
by develatio on Saturday August 14, 2021 @07:21AM
(#28179784)
I'm not sure if this can apply to the most commonly used software. A browser can't know in advance how much memory it would need. Same thing applies for audio, image or video editing software. Probably office suites too.
This might be feasible with some limited-in-features apps, like an audio/video player, an IM client, etc...
Re:Dealing with Out-of-Memory Conditions in Rust
by superjan on Saturday August 14, 2021 @09:21AM
(#28180393)
It won’t. I was thinking more about backend components where you allocate a fixed per request memory budget. It would work best if you could apply the budget per in-flight request. In case a request goes over budget, only the affected (presumably nefarious) request gets terminated, other requests and other processes will run uninterrupted.
Re:Dealing with Out-of-Memory Conditions in Rust
by 1f60c on Saturday August 14, 2021 @09:08AM
(#28180320)
...and missiles: https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98...
Re:Dealing with Out-of-Memory Conditions in Rust
by SiebenHeaven on Saturday August 14, 2021 @11:52AM
(#28181605)
Most commonly used software such as browsers can abort on OOM, this isn't about those cases at all.
In conditions that you do not want to abort, usually you can and would want to allocate pool before hand.