4 ms·
Rust's OOM handler calls abort(). This kills the process, and cannot be caught. i.e. to run rust code that uses the standard library without the chance of abor
by daurnimator 11y ago
Rust's OOM handler calls abort(). This kills the process, and cannot be caught.
i.e. to run rust code that uses the standard library without the chance of abort() on low memory, you need to run it in it's own process.
- kibwen 11y ago> you need to run it in it's own process Assuming that you can detect OOM in userspace at all, which usually isn't the case on Linux (or any other system with overcommit).
- daurnimator 11y agohuh? you'd notice your child process was exited with SIGABRT.
- kibwen 11y agoSIGABRT doesn't necessarily mean OOM, and in any case if you're prepared to monitor child processes for aborts then you'll be perfectly fine with the fact that Rust's default stdlib aborts on OOM, which is the context of this thread.