21bool __CKSafeCopyString(
char** dest,
const char* src,
const char* func = 0,
int line = 0,
const char* file = 0);
22void CKMemoryUsage(
size_t* totalAllocd,
size_t* totalFreed,
int* numOfPtrs);
void*
__CKMalloc(
const char* func,
int line,
const char* file,
size_t size);
void __CKFree(
const char* func,
int line,
const char* file,
void* ptr);
void*
__CKNew(
const char* func,
int line,
const char* file,
size_t size);
void __CKDelete(
void* ptr,
const char* func,
int line,
const char* file);
34inline void __CKDestroy(T* ptr,
const char* file,
const char* func,
int line)
noexcept {
42inline void __CKDestroyArray(T* ptr,
int count,
const char* file,
const char* func,
int line)
noexcept {
44 for (
int i = 0; i < count; ++i)
54#define CKMalloc(sz) __CKMalloc(__func__, __LINE__, __FILENAME__, (sz))
60#define CKFree(ptr) __CKFree(__func__, __LINE__, __FILENAME__, (ptr))
66#define CKNew new (__func__, __LINE__, __FILENAME__)
72#define CKDelete(ptr) __CKDestroy(ptr, __FILENAME__, __func__, __LINE__)
74#define CKNewArray new (__func__, __LINE__, __FILENAME__)
75#define CKDeleteArray(ptr, count) \
76 __CKDestroyArray(ptr, (count), __FILENAME__, __func__, __LINE__)
78inline void*
operator new(
size_t size,
const char* func,
int line,
const char* file) {
79 return __CKNew(func, line, file, size);
81inline void*
operator new[](
size_t size,
const char* func,
int line,
const char* file) {
82 return __CKNew(func, line, file, size);
93#define CKSafeCopyString(dest, src) __CKSafeCopyString(&dest, src, __func__, __LINE__, __FILENAME__)
97#define CKMalloc(size) dlmalloc(size)
98#define CKFree(ptr) dlfree(ptr)
100#define CKDelete(ptr) delete ptr
101#define CKNewArray new[]
102#define CKDeleteArray(ptr, count) delete[] ptr
104#define CKSafeCopyString(dest, src) __CKSafeCopyString(&dest, src, 0, 0, 0)
void CKMemoryDumpLeaks()
Definition ckMemory.cpp:119
void __CKFree(const char *func, int line, const char *file, void *ptr)
Definition ckMemory.cpp:93
void * __CKNew(const char *func, int line, const char *file, size_t size)
Definition ckMemory.cpp:68
bool __CKSafeCopyString(char **dest, const char *src, const char *func=0, int line=0, const char *file=0)
Definition ckMemory.cpp:154
void __CKDelete(void *ptr, const char *func, int line, const char *file)
Definition ckMemory.cpp:76
void __CKDestroy(T *ptr, const char *file, const char *func, int line) noexcept
Definition ckMemory.h:34
void __CKDestroyArray(T *ptr, int count, const char *file, const char *func, int line) noexcept
Definition ckMemory.h:42
void * __CKMalloc(const char *func, int line, const char *file, size_t size)
Definition ckMemory.cpp:84
void CKMemoryUsage(size_t *totalAllocd, size_t *totalFreed, int *numOfPtrs)
Definition ckMemory.cpp:103