Hacker News new | ask | show | jobs
by man8alexd 25 days ago
The last paragraph:

> On the modern desktop, where programmers don't care about failing malloc(), disabling overcommit is shooting yourself in the foot. As you can observe, the memory allocations start failing long before the memory is exhausted.

2 comments

So it's a footgun because a lot of low quality software?
Is Firefox low quality?
Well, if Firefox also works on other OSes, it probably should gracefully handle failing allocations, isn't it?
No, it doesn't handle failing allocations gracefully - https://unix.stackexchange.com/questions/797841/firefox-died...
I lost cookies several times on disk-full condition...
If a memory allocations fails with strict mode then you'll get a null pointer returns and some kind of crash or panic (in code that doesn't handle it properly).

If it fails with the default mode the whole process will get killed by the OS. Is that really much better?

OOM is better. If a program doesn't handle ENOMEM properly, then its state is unpredictable and can lead to data corruption.
I don't think it's as simple as that. Killing a program can have unintended consequences too, e.g. corrupting files they were in the middle of writing.