mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-06-13 23:45:46 +03:00
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:
parent
a6048680a8
commit
160ab9d7f6
19 changed files with 103 additions and 44 deletions
8
test/integration/cpp/failing_new.sh
Normal file
8
test/integration/cpp/failing_new.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
XMALLOC_STR=""
|
||||
if [ "x${enable_xmalloc}" = "x1" ] ; then
|
||||
XMALLOC_STR="xmalloc:false"
|
||||
fi
|
||||
|
||||
export MALLOC_CONF="${XMALLOC_STR}"
|
||||
|
|
@ -3,8 +3,9 @@
|
|||
#include "test/jemalloc_test.h"
|
||||
|
||||
/*
|
||||
* We can't test C++ in unit tests. In order to intercept abort, use the
|
||||
* internal test hook in integration tests.
|
||||
* Verifies that, when jemalloc is built with --enable-cxx-infallible-new,
|
||||
* throwing operator new on OOM aborts via safety_check_fail. The test hook
|
||||
* intercepts the abort and asserts the size-bearing message prefix.
|
||||
*/
|
||||
bool fake_abort_called;
|
||||
void
|
||||
8
test/integration/cpp/infallible_new.sh
Normal file
8
test/integration/cpp/infallible_new.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
XMALLOC_STR=""
|
||||
if [ "x${enable_xmalloc}" = "x1" ] ; then
|
||||
XMALLOC_STR="xmalloc:false"
|
||||
fi
|
||||
|
||||
export MALLOC_CONF="${XMALLOC_STR}"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
XMALLOC_STR=""
|
||||
if [ "x${enable_xmalloc}" = "x1" ] ; then
|
||||
XMALLOC_STR="xmalloc:false,"
|
||||
fi
|
||||
|
||||
export MALLOC_CONF="${XMALLOC_STR}experimental_infallible_new:false"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
XMALLOC_STR=""
|
||||
if [ "x${enable_xmalloc}" = "x1" ] ; then
|
||||
XMALLOC_STR="xmalloc:false,"
|
||||
fi
|
||||
|
||||
export MALLOC_CONF="${XMALLOC_STR}experimental_infallible_new:true"
|
||||
Loading…
Add table
Add a link
Reference in a new issue