News for hackers. Stuff that matters.
Re:The Linux kernel's inability to gracefully handle low mem... by the_why_of_y on Tuesday August 06, 2019 @03:34PM (#20628659)
Do you have an example of a nontrivial user-space project that has malloc failure handling that actually works, with tests and all? The one I'm aware of is SQLite. Then there is DBus, whose author disagrees with your assessment.

https://blog.ometer.com/2008/02/04/out-of-memory-handling-d-...

Re:The Linux kernel's inability to gracefully handle low mem... by wahern on Wednesday August 07, 2019 @08:23PM (#20640661)
Lua, various OS kernels

Like any aspect of writing software, how you approach the problem effects the complexity of the final product. If someone doesn't make a habit of handling OOM, then of course their solutions are going to be messy and complex; they're going to "solve" the problem in the most direct and naive way, which is rarely the best way.

For example, unless I have reason to use a specialized data structure, I use intrusive list and RB-tree implementations, which cuts down on the number of individual allocations many fold. Once I allocate something like a request context, I know that I can add it to various lists and lookup trees without having to worry about allocation failure. Most of my projects have more points where they do I/O operations than memory allocations. Should people just ignore whether their reads or writes failed, too?

Re:The Linux kernel's inability to gracefully handle low mem... by lokedhs on Thursday August 08, 2019 @03:43AM (#20642607)
The JVM, and any other runtime which allocates its heap up front. You could argue that's cheating, but it does give you predictable behaviour.