mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-29 14:22:14 +03:00
Add opt.experimental_infallible_new.
This allows a guarantee that operator new never throws. Fix the .gitignore rules to include test/integration/cpp while we're here.
This commit is contained in:
parent
0689448b1e
commit
4452a4812f
14 changed files with 134 additions and 3 deletions
23
test/integration/cpp/infallible_new_false.cpp
Normal file
23
test/integration/cpp/infallible_new_false.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#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);
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue