MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / mi_try_new_handler

Function mi_try_new_handler

3rd/mimalloc-2.0.9/src/alloc.c:878–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876#ifdef __cplusplus
877#include <new>
878static bool mi_try_new_handler(bool nothrow) {
879 #if defined(_MSC_VER) || (__cplusplus >= 201103L)
880 std::new_handler h = std::get_new_handler();
881 #else
882 std::new_handler h = std::set_new_handler();
883 std::set_new_handler(h);
884 #endif
885 if (h==NULL) {
886 _mi_error_message(ENOMEM, "out of memory in 'new'");
887 if (!nothrow) {
888 throw std::bad_alloc();
889 }
890 return false;
891 }
892 else {
893 h();
894 return true;
895 }
896}
897#else
898typedef void (*std_new_handler_t)(void);
899

Callers 6

mi_heap_try_newFunction · 0.85
mi_heap_alloc_new_nFunction · 0.85
mi_new_alignedFunction · 0.85
mi_new_aligned_nothrowFunction · 0.85
mi_new_reallocFunction · 0.85
mi_new_reallocnFunction · 0.85

Calls 2

_mi_error_messageFunction · 0.85
mi_get_new_handlerFunction · 0.85

Tested by

no test coverage detected