6#if !defined(CXMEMORY_INCLUDE_H)
7#define CXMEMORY_INCLUDE_H
15BEGIN_MOOTOOLS_NAMESPACE
19#ifndef MOOTOOLS_USE_NEW_AND_DELETE
79 DLL_TOOLSFUNCTION
void *xmalloc(
size_t nSize);
80 DLL_TOOLSFUNCTION
void xfree(
void *p);
81 DLL_TOOLSFUNCTION
void *xrealloc(
void *p,
size_t newSize);
93 #define xmalloc(nSize) xmalloc_dbg(nSize, __FILE__, __DATE__, __LINE__)
94 #define xfree(nSize) xfree_dbg(nSize, __FILE__, __DATE__, __LINE__)
95 #define xrealloc(p, nSize) xrealloc_dbg(p, nSize, __FILE__, __DATE__, __LINE__)
96 #define xcalloc(num, nSize) xcalloc_dbg(num, nSize, __FILE__, __DATE__, __LINE__)
97 #define xmalloc_array(nSize, nCount) xmalloc_dbg((nSize)*(nCount), __FILE__, __DATE__, __LINE__)
98 #define xfree_array(p, nCount) xfree_dbg(p, __FILE__, __DATE__, __LINE__)
100 #define xnew(nSize) xnew_dbg(nSize, __FILE__, __DATE__, __LINE__)
101 #define xdelete(p) xdelete_dbg(p, __FILE__, __DATE__, __LINE__)
102 #define xnew_array(nSize, nCount) xnew_array_dbg(nSize, nCount, __FILE__, __DATE__, __LINE__)
103 #define xdelete_array(p, nCount) xdelete_array_dbg(p, nCount, __FILE__, __DATE__, __LINE__)
116 #define xmalloc_array(nSize, nCount) xmalloc((nSize)*(nCount))
117 #define xfree_array(p, nCount) xfree(p)
118 #define xnew_array(nSize, nCount) xnew((nSize)*(nCount))
119 #define xdelete_array(p, nCount) xdelete(p)
122 #define DisableMemoryLeaksChecking() {}
123 #define xmalloc malloc
124 #define xmalloc_array malloc
126 #define xrealloc realloc
127 #define xcalloc calloc
132END_MOOTOOLS_NAMESPACE
DLL_TOOLSFUNCTION XMemoryCallback memoryCallbackNotify
void(* freeCallback)(void *pointer, XAllocType type)
Called by free / delete operation.
Definition XMemory.h:46
void *(* mallocCallback)(size_t newSize, XAllocType type)
Called by malloc / calloc / new operation.
Definition XMemory.h:44
DLL_TOOLSFUNCTION void * xnew(size_t nSize)
Only used by macros xNew.
void *(* reallocCallback)(void *pointer, size_t newSize)
Called by realloc operation.
Definition XMemory.h:45
DLL_TOOLSFUNCTION void xdelete(void *p)
Only used by macros xDelete.
XAllocType
Defines the required allocation type provided through XMemoryCallback callback.
Definition XMemory.h:24
@ XALLOC_CALLOC_ALIGNED
Not used.
Definition XMemory.h:34
@ XALLOC_NEW
new C++
Definition XMemory.h:31
@ XALLOC_DELETE
delete C++
Definition XMemory.h:32
@ XALLOC_MALLOC_ALIGNED
Not used.
Definition XMemory.h:33
@ XALLOC_FREE
free C method
Definition XMemory.h:30
@ XALLOC_CALLOC
calloc C method. Do not forget to call something equivalent to calloc that set memory to 0
Definition XMemory.h:29
@ XALLOC_MALLOC
malloc C method
Definition XMemory.h:28
@ XALLOC_NEW_ALIGNED
Not used.
Definition XMemory.h:35
definitions of macros for SDK new / delete / allocation operators.
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
Defines a set of memory callback handlers that can be modified.
Definition XMemory.h:53