|
|
|
|
|
by walrus
3005 days ago
|
|
It's not the case that malloc always works under Linux. It may return NULL if the memory is not available. Try it out! Write a program that allocates half your memory, fills it with 0xFF, then sleeps. Run two instances of it. The malloc will fail in the second one. According to [1], the OOM killer is a consequence of the fork syscall, and can't be removed without breaking backward compatibility. [1] https://drewdevault.com/2018/01/02/The-case-against-fork.htm... |
|