News for hackers. Stuff that matters.
Re:Investigating the Performance Overhead of C++ Exceptions by ncmncm on Wednesday February 12, 2020 @12:46AM (#22306168)
When the global allocator fails, you might not be able to do much... except set a flag, and free a big block of memory that was reserved against just such an event.

Then the program can do whatever cleanup is warranted, maybe freeing up a variety of other resources, and then maybe re-reserve that block, and forge ahead.

But when you actually care about performance, you often are not using the global allocator. A local allocation failure is nothing to panic over. Generally, only the higher level code -- where the handler is -- knows, or needs to care, what kind of allocator failed. The low-level code gets to just bail out, as it should.

Re:Investigating the Performance Overhead of C++ Exceptions by hoseja on Wednesday February 12, 2020 @03:12AM (#22306899)
You could also have just tried to allocate 42 terabytes of memory and have a well defined strategy for what to do in case this fails...
Re:Investigating the Performance Overhead of C++ Exceptions by daemin on Wednesday February 12, 2020 @06:09AM (#22307837)
Yeah, but in that case you would use your own allocator fit for this purpose and not just new or malloc.