17 #ifndef AGX_ALLOCATOR_H
18 #define AGX_ALLOCATOR_H
20 #include <agx/config/AGX_DEBUG_INTRUSIVE.h>
28 #if defined(AGX_DEBUG)
32 #if defined(AGX_TRACK_ALLOCATIONS)
36 # pragma warning(push)
37 # pragma warning( disable : 4290 )
43 void *
operator new(
size_t size)
throw(std::bad_alloc);
44 void *
operator new(
size_t size,
void *ptr)
throw();
45 void operator delete(
void *ptr)
throw();
65 const char *getName()
const;
72 void deallocateBytes(
void *buffer);
86 #ifdef AGX_TRACK_ALLOCATIONS
87 size_t getNumActiveAllocations()
const;
88 size_t getTotalActiveAllocationSize()
const;
92 #if AGX_DEBUG_INTRUSIVE()
97 #ifdef AGX_TRACK_ALLOCATIONS
98 size_t m_numActiveAllocations;
99 size_t m_totalActiveAllocationSize;
107 template <
typename T>
111 Allocator(
const char *name =
"Allocator");
130 template <
typename T>
153 #if AGX_DEBUG_INTRUSIVE()
160 #ifdef AGX_TRACK_ALLOCATIONS
161 m_numActiveAllocations = 0;
162 m_totalActiveAllocationSize = 0;
168 #if AGX_DEBUG_INTRUSIVE()
171 return "AllocatorNameOnlyAvaiableInDebugBuild";
180 template <
typename T>
186 template <
typename T>
192 template <
typename T>
201 template <
typename T>
207 template <
typename T>
213 template <
typename T>
221 #if defined(AGX_TRACK_ALLOCATIONS)
223 # pragma warning(pop)
void deallocate(T *buffer)
T * allocate(size_t numElements)
AlignedAllocator(const char *name="AlignedAllocator", agx::UInt32 aligment=128)
void deallocate(T *buffer)
T * allocate(size_t numElements)
Allocate/deallocate raw memory.
Allocator(const char *name="Allocator")
static bool initMemoryFlag
static void standaloneDeallocateTypes(void *buffer)
static agx::UInt32 allocatedMemoryPattern
void * allocateBytes(size_t numBytes, size_t alignment=16)
Allocate a memory section of specified alignment.
void setContainer(class Container *)
static agx::UInt32 deallocatedMemoryPattern
static void initMemory(void *data, size_t numBytes, agx::UInt32 pattern)
static void * standaloneAllocateBytes(size_t numBytes, size_t alignment=16)
void deallocateBytes(void *buffer, size_t numBytes)
Deallocate a section previously allocated using allocateBytes method.
ByteAllocator & operator=(const ByteAllocator &other)
ByteAllocator(const char *name="ByteAllocator")
const char * getName() const
ByteAllocator(const ByteAllocator &other)
The Container is the base class for several of the container classes proided by AGX,...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.