Operator new and bad_alloc on linux

bad-alloc, c++, linux, new-operator

Solution

The same is true for operator new, alas :^(

Problem

On Linux, malloc doesn't necessarily return a null pointer if you're out of memory. You might get back a pointer and then have the OOM killer start eating processes if you're really out of memory. Is the same true for c++'s operator new or will you get the bad_alloc exception?

Original source