File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -291,22 +291,25 @@ void *memalign(std::size_t alignment, std::size_t size) {
291
291
}
292
292
}
293
293
294
- // c++14 guarantees that it is enough to override these two operators.
294
+ // c++17 guarantees that it is enough to override these 4 operators
295
295
void *operator new (std::size_t count) {
296
296
return malloc_with_frame (count, get_backtrace ());
297
297
}
298
298
void operator delete (void *ptr) noexcept (true ) {
299
299
free (ptr);
300
300
}
301
+ void *operator new (std::size_t count, std::align_val_t al) {
302
+ return memalign (static_cast <std::size_t >(al), count);
303
+ }
304
+ void operator delete (void *ptr, std::align_val_t al) noexcept {
305
+ free (ptr);
306
+ }
307
+
301
308
// because of gcc warning: the program should also define 'void operator delete(void*, std::size_t)'
302
309
void operator delete (void *ptr, std::size_t ) noexcept (true ) {
303
310
free (ptr);
304
311
}
305
312
306
- // c++17
307
- // void *operator new(std::size_t count, std::align_val_t al);
308
- // void operator delete(void *ptr, std::align_val_t al);
309
-
310
313
#else
311
314
bool is_memprof_on () {
312
315
return false ;
You can’t perform that action at this time.
0 commit comments