P
Paul
If your goal is to improve robustness by logging the OOM condition,
then it's not just essential, it's mandatory. If you fail to do it,
you failed to improve robustness.
Then you don't know many languages! Java, Python, and many others
provide robust, enterprise-grade logging facilities out of the box.
Haskell, Erlang, and many others provide all sorts of transactional
facilities, depending on exactly what you want, out of the box.
You're just making the cost/value proposition worse, not better.
That's even more code I have to write!
No, that's not even how the discussion started. One of the major
advocates for handling OOM suggested this was not only possible, but
trivial.
Nope. All the other requests can die while you're trying to handle
the OOM condition. Or the other side could drop the request because
they got tired of waiting. The reality of the matter is that both
will happen.
Yes, it is. It requires me to rewrite a considerable number of
language and sometimes even OS facilities, something you have admitted
yourself! The entire reason I'm using a programming language is
because it provides useful facilities for me As a result, it isn't
the least bit unreasonable to conclude that rewriting language
facilities is hard. If I wanted to be doing to be writing language
facilities, then I'd just write my own damn programming language in
the first place!
But how much effort is it to just enclose all allocations in a try-
catch block?
It's only one try block and this is all provided as a language
feature.
Applications that require a response to OOM other than terminate are
an unsubstantial minority. Systems that cannot permit termination as
an OOM response are almost certainly broken.
Looking at a user application on windows, termination on low memory
condition is permitted but if the program were just to terminate at
the slightest whiff of low memory it wouldn't be a very well written
program IMHO. At least give an error message and inform the user why
you are closing before termination, or just terminate the process that
the memeory was requested for and keep the program alive thus allowing
the user to close other apps and free up some memory.
If some other program is leaking memory, your program will get the
blame as being a rogue program because it just crashed in an
unproffessional way. This alone is a good reason for error checking.