 |
AGXDynamics
2.35.0.2
|
Go to the documentation of this file.
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;
68 void *allocateBytes(
size_t numBytes,
size_t alignment = 16);
71 void deallocateBytes(
void *buffer,
size_t numBytes);
72 void deallocateBytes(
void *buffer);
77 static void* standaloneAllocateBytes(
size_t numBytes,
size_t alignment = 16);
78 static void standaloneDeallocateTypes(
void* buffer);
83 static void initMemory(
void *data,
size_t numBytes,
agx::UInt32 pattern);
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)
T * allocate(size_t numElements)
Allocate/deallocate raw memory.
T * allocate(size_t numElements)
AlignedAllocator(const char *name="AlignedAllocator", agx::UInt32 aligment=128)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
void * allocateBytes(size_t numBytes, size_t alignment=16)
Allocate a memory section of specified alignment.
static agx::UInt32 deallocatedMemoryPattern
const char * getName() const
static bool initMemoryFlag
void deallocate(T *buffer)
void deallocate(T *buffer)
The Container is the base class for several of the container classes proided by AGX,...
ByteAllocator(const char *name="ByteAllocator")
void setContainer(class Container *)
void deallocateBytes(void *buffer, size_t numBytes)
Deallocate a section previously allocated using allocateBytes method.
static agx::UInt32 allocatedMemoryPattern
Allocator(const char *name="Allocator")