2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CMEMORY
|
|
|
|
#define _CMEMORY
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
|
|
|
namespace CMemory {
|
2022-10-01 06:19:09 +00:00
|
|
|
void* Alloc(size_t sz);
|
2022-04-10 00:17:06 +00:00
|
|
|
void Free(const void* ptr);
|
|
|
|
} // namespace CMemory
|
|
|
|
|
2022-10-01 06:19:09 +00:00
|
|
|
void* operator new(size_t sz, const char*, const char*);
|
|
|
|
void* operator new[](size_t sz, const char*, const char*);
|
|
|
|
inline void* operator new(size_t sz) { return operator new(sz, "??(??)", nullptr); }
|
|
|
|
inline void* operator new[](size_t sz) { return operator new[](sz, "??(??)", nullptr); }
|
2022-04-10 00:17:06 +00:00
|
|
|
// placement new
|
2022-10-01 06:19:09 +00:00
|
|
|
inline void* operator new(size_t n, void* ptr) { return ptr; };
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
inline void operator delete(void* ptr) { CMemory::Free(ptr); }
|
2022-10-01 06:19:09 +00:00
|
|
|
inline void operator delete[](void* ptr) { CMemory::Free(ptr); }
|
2022-04-10 00:17:06 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CMEMORY
|