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"
|
|
|
|
|
|
|
|
void *operator new(std::size_t size) { return kMalloc(size); }
|
|
|
|
void *operator new[](std::size_t size) { return kMalloc(size); }
|
|
|
|
|
|
|
|
void operator delete(void *ptr) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr) noexcept { kFree(ptr); }
|
|
|
|
|
|
|
|
|
|
|
|
#if __cplusplus >= 201703L
|
|
|
|
void *operator new(std::size_t size, std::align_val_t align) { return dlmemalign((size_t)align, size); }
|
|
|
|
void *operator new[](std::size_t size, std::align_val_t align) { return dlmemalign((size_t)align, size); }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if __cplusplus >= 201402L
|
|
|
|
void operator delete(void *ptr, std::size_t size) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr, std::size_t size) noexcept { kFree(ptr); }
|
|
|
|
#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); }
|
|
|
|
void operator delete(void *ptr, std::size_t size, std::align_val_t align) noexcept { kFree(ptr); }
|
|
|
|
void operator delete[](void *ptr, std::size_t size, std::align_val_t align) noexcept { kFree(ptr); }
|
|
|
|
#endif
|