Replace experimental_infallible_new with compile-time flag

The runtime option aborted on every OOM, breaking new(std::nothrow)
semantics. Replace with configure-time --enable-cxx-infallible-new
(default off): when on, throwing new aborts (size logged) and
nothrow returns null; when off, standard new_handler + bad_alloc /
null behavior is preserved. Under LTO the on-path lets the compiler
prove operator new is no-throw.
This commit is contained in:
Slobodan Predolac 2026-06-04 10:58:43 -07:00
parent a6048680a8
commit 160ab9d7f6
19 changed files with 103 additions and 44 deletions

View file

@ -1,21 +0,0 @@
#include <memory>
#include "test/jemalloc_test.h"
TEST_BEGIN(test_failing_alloc) {
bool saw_exception = false;
try {
/* Too big of an allocation to succeed. */
void *volatile ptr = ::operator new((size_t)-1);
(void)ptr;
} catch (...) {
saw_exception = true;
}
expect_true(saw_exception, "Didn't get a failure");
}
TEST_END
int
main(void) {
return test(test_failing_alloc);
}