2021-10-23 18:36:31 +08:00
|
|
|
#include "memory.h"
|
2021-10-10 14:39:17 +08:00
|
|
|
#include "memory.hpp"
|
|
|
|
|
2021-10-23 18:36:31 +08:00
|
|
|
#include "../extlib/dlmalloc/malloc-2.8.6.h"
|
|
|
|
|
2021-11-04 20:15:58 +08:00
|
|
|
void *operator new(size_t size) { return kMalloc(size); }
|
|
|
|
void *operator new[](size_t size) { return kMalloc(size); }
|
2021-10-23 18:36:31 +08:00
|
|
|
|
|
|
|
void operator delete(void *ptr) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr) noexcept { kFree(ptr); }
|
|
|
|
|
|
|
|
|
|
|
|
#if __cplusplus >= 201703L
|
2021-11-04 20:15:58 +08:00
|
|
|
void *operator new(size_t size, std::align_val_t align) { return dlmemalign((size_t)align, size); }
|
|
|
|
void *operator new[](size_t size, std::align_val_t align) { return dlmemalign((size_t)align, size); }
|
2021-10-23 18:36:31 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __cplusplus >= 201402L
|
2021-11-04 20:15:58 +08:00
|
|
|
void operator delete(void *ptr, size_t size) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr, size_t size) noexcept { kFree(ptr); }
|
2021-10-23 18:36:31 +08:00
|
|
|
#endif
|
|
|
|
#if __cplusplus >= 201703L
|
|
|
|
void operator delete(void *ptr, std::align_val_t align) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr, std::align_val_t align) noexcept { kFree(ptr); }
|
2021-11-04 20:15:58 +08:00
|
|
|
void operator delete(void *ptr, size_t size, std::align_val_t align) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr, size_t size, std::align_val_t align) noexcept { kFree(ptr); }
|
2021-10-23 18:36:31 +08:00
|
|
|
#endif
|