Re:Dealing with Out-of-Memory Conditions in Rust
by lmilcin on Saturday August 14, 2021 @06:40PM
(#28184555)
> Nothing is 100% reliable, thats not realistic,
My comments were directed at people who are interested in building reliable systems.
If you straight assume it is not possible to build reliable systems, you are missing a lot.
Re:Dealing with Out-of-Memory Conditions in Rust
by SigmundA on Saturday August 14, 2021 @09:12PM
(#28185375)
A program that can handle an OOM and continue to function normally is more reliable to the user than one that crashes and must be restarted potentially losing work.
Memory allocation can fail, network connections are not reliable , opening a file may fail, writing a file may fail and so on. If your program simply crashed because some operation failed it would only be reliable at crashing.
Re:Dealing with Out-of-Memory Conditions in Rust
by ElectricalUnion on Sunday August 15, 2021 @12:26AM
(#28186266)
> continue to function normally
By definition, you are not functioning normally if you're OOM.
Re:Dealing with Out-of-Memory Conditions in Rust
by SigmundA on Sunday August 15, 2021 @07:38AM
(#28187944)
If you try an operation that causes an OOM by say allocating a large amount of memory as the example given above, then that memory is freed you are now functioning normally again.
If you write a large file to disk filling it to capacity, failing then delete the file, now you have free space again and everything is normal.
Nothing is 100% reliable, thats not realistic, and in this kind of situation its is not a 50/50 shot, its more like 10000/1 that you will be able to show a message, that should be obvious.
>It would be better to wrap your application in a script that detects when the application quit and only then shows a message to the user.
Thats simpler then wrapping the specific function in a "script" that shows message to the user but allows the program to continue to function in almost all situations?
>People designing things like you drive me crazy. They come up with a huge number of contingencies that just don't work in practice when push comes to shove.
People like you who do not value you the user experience over pure code drive me crazy. These things actually do work in practice, I guarantee you any sufficiently complex GUI program will have code like this to try and gracefully handle as many contingencies as possible before simply crashing. Do you think your browser should just crash losing other tabs if a web site loads too much data? Does Photoshop just crash if it runs out of memory on an operation losing all your work?
>Stuck in a loop trying to show a widget, using 100% of CPU and preventing me to do any action?
Its no more stuck than your process crashing and the kernel is reclaiming memory, they both take similar cpu time, one however results in a message that informs you of what happens and leaves you with a running program, the other tells you nothing and your program is now gone.