@@ -36,28 +36,44 @@ extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__));
36
36
37
37
// overwrite weak operators new/new[] definitions
38
38
39
- void * operator new (size_t size)
39
+ void * operator new (size_t size)
40
40
{
41
41
void *ret = malloc (size);
42
42
if (0 != size && 0 == ret) {
43
43
umm_last_fail_alloc_addr = __builtin_return_address (0 );
44
44
umm_last_fail_alloc_size = size;
45
- #if defined(NEW_OOM_ABORT)
46
45
__unhandled_exception (PSTR (" OOM" ));
47
- #endif
48
46
}
49
- return ret;
47
+ return ret;
50
48
}
51
49
52
- void * operator new [](size_t size)
50
+ void * operator new [](size_t size)
53
51
{
54
52
void *ret = malloc (size);
55
53
if (0 != size && 0 == ret) {
56
54
umm_last_fail_alloc_addr = __builtin_return_address (0 );
57
55
umm_last_fail_alloc_size = size;
58
- #if defined(NEW_OOM_ABORT)
59
56
__unhandled_exception (PSTR (" OOM" ));
60
- #endif
57
+ }
58
+ return ret;
59
+ }
60
+
61
+ void * operator new (size_t size, const std::nothrow_t &)
62
+ {
63
+ void *ret = malloc (size);
64
+ if (0 != size && 0 == ret) {
65
+ umm_last_fail_alloc_addr = __builtin_return_address (0 );
66
+ umm_last_fail_alloc_size = size;
67
+ }
68
+ return ret;
69
+ }
70
+
71
+ void * operator new [] (size_t size, const std::nothrow_t &)
72
+ {
73
+ void *ret = malloc (size);
74
+ if (0 != size && 0 == ret) {
75
+ umm_last_fail_alloc_addr = __builtin_return_address (0 );
76
+ umm_last_fail_alloc_size = size;
61
77
}
62
78
return ret;
63
79
}
0 commit comments