9#ifndef JPH_DISABLE_CUSTOM_ALLOCATOR
40#if defined(JPH_COMPILER_MINGW) && JPH_CPU_ADDRESS_BITS == 32
41 #define JPH_INTERNAL_DEFAULT_ALLOCATE(size) JPH::AlignedAllocate(size, 16)
42 #define JPH_INTERNAL_DEFAULT_FREE(pointer) JPH::AlignedFree(pointer)
44 #define JPH_INTERNAL_DEFAULT_ALLOCATE(size) JPH::Allocate(size)
45 #define JPH_INTERNAL_DEFAULT_FREE(pointer) JPH::Free(pointer)
49#define JPH_OVERRIDE_NEW_DELETE \
50 JPH_INLINE void *operator new (size_t inCount) { return JPH_INTERNAL_DEFAULT_ALLOCATE(inCount); } \
51 JPH_INLINE void operator delete (void *inPointer) noexcept { JPH_INTERNAL_DEFAULT_FREE(inPointer); } \
52 JPH_INLINE void *operator new[] (size_t inCount) { return JPH_INTERNAL_DEFAULT_ALLOCATE(inCount); } \
53 JPH_INLINE void operator delete[] (void *inPointer) noexcept { JPH_INTERNAL_DEFAULT_FREE(inPointer); } \
54 JPH_INLINE void *operator new (size_t inCount, std::align_val_t inAlignment) { return JPH::AlignedAllocate(inCount, static_cast<size_t>(inAlignment)); } \
55 JPH_INLINE void operator delete (void *inPointer, [[maybe_unused]] std::align_val_t inAlignment) noexcept { JPH::AlignedFree(inPointer); } \
56 JPH_INLINE void *operator new[] (size_t inCount, std::align_val_t inAlignment) { return JPH::AlignedAllocate(inCount, static_cast<size_t>(inAlignment)); } \
57 JPH_INLINE void operator delete[] (void *inPointer, [[maybe_unused]] std::align_val_t inAlignment) noexcept { JPH::AlignedFree(inPointer); } \
58 JPH_INLINE void *operator new ([[maybe_unused]] size_t inCount, void *inPointer) noexcept { return inPointer; } \
59 JPH_INLINE void operator delete ([[maybe_unused]] void *inPointer, [[maybe_unused]] void *inPlace) noexcept { } \
60 JPH_INLINE void *operator new[] ([[maybe_unused]] size_t inCount, void *inPointer) noexcept { return inPointer; } \
61 JPH_INLINE void operator delete[] ([[maybe_unused]] void *inPointer, [[maybe_unused]] void *inPlace) noexcept { }
76#define JPH_OVERRIDE_NEW_DELETE
#define JPH_EXPORT
Definition Core.h:275
#define JPH_NAMESPACE_END
Definition Core.h:419
#define JPH_NAMESPACE_BEGIN
Definition Core.h:413
void *(*)(void *inBlock, size_t inOldSize, size_t inNewSize) ReallocateFunction
Reallocate memory. inBlock can be nullptr in which case it must behave as a memory allocation.
Definition Memory.h:15
void *(*)(size_t inSize, size_t inAlignment) AlignedAllocateFunction
Aligned memory allocation.
Definition Memory.h:21
JPH_EXPORT AlignedAllocateFunction AlignedAllocate
Definition Memory.cpp:71
void(*)(void *inBlock) FreeFunction
Free memory. inBlock can be nullptr in which case it must do nothing.
Definition Memory.h:18
JPH_EXPORT void RegisterDefaultAllocator()
Register platform default allocation / free functions.
Definition Memory.cpp:74
JPH_EXPORT AllocateFunction Allocate
Definition Memory.cpp:68
JPH_EXPORT ReallocateFunction Reallocate
Definition Memory.cpp:69
JPH_EXPORT AlignedFreeFunction AlignedFree
Definition Memory.cpp:72
void(*)(void *inBlock) AlignedFreeFunction
Free aligned memory. inBlock can be nullptr in which case it must do nothing.
Definition Memory.h:24
void *(*)(size_t inSize) AllocateFunction
Normal memory allocation, must be at least 8 byte aligned on 32 bit platform and 16 byte aligned on 6...
Definition Memory.h:12
JPH_EXPORT FreeFunction Free
Definition Memory.cpp:70