32#include "foundation/PxAllocatorCallback.h"
33#include "foundation/PxAssert.h"
34#include "foundation/PxFoundation.h"
35#include "foundation/Px.h"
39#pragma warning(disable : 4577)
68#define PX_ALLOC(n, name) physx::PxAllocator().allocate(n, __FILE__, __LINE__)
71#define PX_ALLOCATE(type, count, name) reinterpret_cast<type*>(PX_ALLOC(count*sizeof(type), name))
76 physx::PxAllocator().deallocate(x); \
80#define PX_FREE_THIS physx::PxAllocator().deallocate(this)
82#define PX_NEW(T) new (physx::PxReflectionAllocator<T>(), __FILE__, __LINE__) T
83#define PX_PLACEMENT_NEW(p, T) new (p) T
84#define PX_DELETE_THIS delete this
85#define PX_DELETE(x) if(x) { delete x; x = NULL; }
86#define PX_DELETE_ARRAY(x) if(x) { delete []x; x = NULL; }
87#define PX_RELEASE(x) if(x) { x->release(); x = NULL; }
101 PX_FORCE_INLINE void* allocate(
size_t size,
const char* file,
int line)
125 return ::malloc(size);
145 virtual void* allocate(
const size_t size,
const int group,
const char* file,
const int line) = 0;
146 virtual void deallocate(
void* ptr) = 0;
162 PX_FORCE_INLINE void* allocate(
const size_t size,
const char* file,
const int line)
164 PX_ASSERT(mCallback);
166 return mCallback->allocate(size, mGroup, file, line);
172 PX_ASSERT(mCallback);
174 mCallback->deallocate(ptr);
186 template <
typename T>
189 static const char* getName()
192 return "<allocation names disabled>";
194 return __PRETTY_FUNCTION__;
197 return typeid(T).name();
207 PX_FORCE_INLINE void* allocate(
size_t size,
const char* filename,
int line)
219 template <
typename T>
virtual void deallocate(void *ptr)=0
Frees memory previously allocated by allocate().
virtual void * allocate(size_t size, const char *typeName, const char *filename, int line)=0
Allocates size bytes of memory, which must be 16-byte aligned.
Definition PxAllocator.h:97
Definition PxAllocator.h:118
Definition PxAllocator.h:188
Definition PxAllocator.h:140
Definition PxAllocator.h:158
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation &PX_CALL_CONV PxGetFoundation()
Retrieves the Foundation SDK after it has been created.
Definition FdFoundation.cpp:279
PX_C_EXPORT PX_FOUNDATION_API physx::PxAllocatorCallback *PX_CALL_CONV PxGetBroadcastAllocator()
Get the broadcasting allocator callback.
Definition FdFoundation.cpp:264
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxEMPTY
Definition Px.h:87
Definition PxAllocator.h:221