|
|
|
|
|
by pcwalton
3741 days ago
|
|
>
No custom allocator can make a task that fails to allocate gracefully report an error. Yes, you can. You can panic the thread, and you can recover from panics. But honestly this is never enough to gracefully recover from OOM. I can't think of any software that uses exceptions to gracefully recover from OOM (i.e. without crashing the process) in a way that works. How many Java applications do you see that catch OutOfMemoryError on a fine-grained level? > Had Rust opted for exceptions, it'd be a much better, and actually usable, language. Rust's terribly error-handling strategy is the chief reason not to use it. It's hyperbolic to call Rust's error handling strategy not "actually usable". I use it every day and never have any issues with it. |
|
I wrote exactly that sort of code, in Java, last week.