Re:Once upon a time, memory allocators made sense
by JoeAltmaier on Monday January 18, 2016 @09:35AM
(#10924574)
I with you on the no-point-checking-for-malloc-fail issue. It has to be done in every place, or it rarely is effective. My old colleage Mike Rowe used to call it "Putting an altimeter on your car. So if you drive over a cliff, you can see how far it is to the ground."
[ Parent
| on HN ]
Re:Once upon a time, memory allocators made sense
by joosters on Monday January 18, 2016 @11:32AM
(#10925283)
Definitely. In practice, it's impossible to do correctly. Even if your own code gets every malloc() correct (and also properly checks the return code of every syscall and library call that might fail due to lack of memory), you still have to trust that every library you use is also perfectly written and handles its memory failures just as perfectly. It'll never happen.
Re:Once upon a time, memory allocators made sense
by JoeAltmaier on Monday January 18, 2016 @11:59AM
(#10925424)
There's just one place that it makes sense: for very large buffers. If they fail, it doesn't mean the system is doomed. So it doesn't hurt to check that video-frame buffer alloc, or that file-decompression buffer. But for any of the small change (anything within orders of magnitude of the mean allocation size) its pointless.