27    virtual void                    Free(
void *inAddress, 
uint inSize) = 0;
 
   62                Trace(
"TempAllocator: Out of memory");
 
   65            void *address = mBase + mTop;
 
   72    virtual void                    Free(
void *inAddress, 
uint inSize)
 override 
   74        if (inAddress == 
nullptr)
 
   81            if (mBase + mTop != inAddress)
 
   83                Trace(
"TempAllocator: Freeing in the wrong order");
 
  116        return inAddress >= mBase && inAddress < mBase + mSize;
 
  139    virtual void                    Free(
void *inAddress, [[maybe_unused]] 
uint inSize)
 override 
  141        if (inAddress != 
nullptr)
 
  161        if (mAllocator.CanAllocate(inSize))
 
  162            return mAllocator.Allocate(inSize);
 
  164            return mFallbackAllocator.Allocate(inSize);
 
  168    virtual void                    Free(
void *inAddress, 
uint inSize)
 override 
  170        if (inAddress == 
nullptr)
 
  176            if (mAllocator.OwnsMemory(inAddress))
 
  177                mAllocator.Free(inAddress, inSize);
 
  179                mFallbackAllocator.Free(inAddress, inSize);
 
std::uint8_t uint8
Definition: Core.h:453
 
#define JPH_EXPORT
Definition: Core.h:236
 
unsigned int uint
Definition: Core.h:452
 
#define JPH_NAMESPACE_END
Definition: Core.h:378
 
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
 
TraceFunction Trace
Definition: IssueReporting.cpp:18
 
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
 
T AlignUp(T inV, uint64 inAlignment)
Align inV up to the next inAlignment bytes.
Definition: Math.h:80
 
AlignedFreeFunction AlignedFree
Definition: Memory.cpp:72
 
AlignedAllocateFunction AlignedAllocate
Definition: Memory.cpp:71
 
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
 
#define JPH_RVECTOR_ALIGNMENT
Definition: Real.h:34
 
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition: NonCopyable.h:11
 
Definition: TempAllocator.h:16
 
virtual void Free(void *inAddress, uint inSize)=0
Frees inSize bytes of memory located at inAddress.
 
virtual void * Allocate(uint inSize)=0
Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.
 
virtual JPH_OVERRIDE_NEW_DELETE ~TempAllocator()=default
Destructor.
 
Default implementation of the temp allocator that allocates a large block through malloc upfront.
Definition: TempAllocator.h:32
 
bool OwnsMemory(const void *inAddress) const
Check if memory block at inAddress is owned by this allocator.
Definition: TempAllocator.h:114
 
virtual ~TempAllocatorImpl() override
Destructor, frees the block.
Definition: TempAllocator.h:44
 
JPH_OVERRIDE_NEW_DELETE TempAllocatorImpl(uint inSize)
Constructs the allocator with a maximum allocatable size of inSize.
Definition: TempAllocator.h:37
 
virtual void Free(void *inAddress, uint inSize) override
Frees inSize bytes of memory located at inAddress.
Definition: TempAllocator.h:72
 
bool CanAllocate(uint inSize) const
Check if an allocation of inSize can be made in this fixed buffer allocator.
Definition: TempAllocator.h:108
 
uint GetSize() const
Get the total size of the fixed buffer.
Definition: TempAllocator.h:96
 
bool IsEmpty() const
Check if no allocations have been made.
Definition: TempAllocator.h:90
 
virtual void * Allocate(uint inSize) override
Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.
Definition: TempAllocator.h:51
 
uint GetUsage() const
Get current usage in bytes of the buffer.
Definition: TempAllocator.h:102
 
Implementation of the TempAllocator that tries to allocate from a large preallocated block,...
Definition: TempAllocator.h:148
 
JPH_OVERRIDE_NEW_DELETE TempAllocatorImplWithMallocFallback(uint inSize)
Constructs the allocator with an initial fixed block if inSize.
Definition: TempAllocator.h:153
 
virtual void Free(void *inAddress, uint inSize) override
Frees inSize bytes of memory located at inAddress.
Definition: TempAllocator.h:168
 
virtual void * Allocate(uint inSize) override
Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.
Definition: TempAllocator.h:159
 
Definition: TempAllocator.h:128
 
virtual void Free(void *inAddress, uint inSize) override
Frees inSize bytes of memory located at inAddress.
Definition: TempAllocator.h:139
 
virtual JPH_OVERRIDE_NEW_DELETE void * Allocate(uint inSize) override
Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.
Definition: TempAllocator.h:133