Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
TempAllocatorImpl Class Referencefinal

Default implementation of the temp allocator that allocates a large block through malloc upfront. More...

#include <TempAllocator.h>

Inheritance diagram for TempAllocatorImpl:
TempAllocator NonCopyable

Public Member Functions

JPH_OVERRIDE_NEW_DELETE TempAllocatorImpl (size_t inSize)
 Constructs the allocator with a maximum allocatable size of inSize.
 
virtual ~TempAllocatorImpl () override
 Destructor, frees the block.
 
virtual void * Allocate (uint inSize) override
 Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.
 
virtual void Free (void *inAddress, uint inSize) override
 Frees inSize bytes of memory located at inAddress.
 
bool IsEmpty () const
 Check if no allocations have been made.
 
size_t GetSize () const
 Get the total size of the fixed buffer.
 
size_t GetUsage () const
 Get current usage in bytes of the buffer.
 
bool CanAllocate (uint inSize) const
 Check if an allocation of inSize can be made in this fixed buffer allocator.
 
bool OwnsMemory (const void *inAddress) const
 Check if memory block at inAddress is owned by this allocator.
 
- Public Member Functions inherited from TempAllocator
virtual ~TempAllocator ()=default
 Destructor.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Additional Inherited Members

- Static Public Attributes inherited from TempAllocator
static JPH_OVERRIDE_NEW_DELETE constexpr bool needs_aligned_allocate = JPH_RVECTOR_ALIGNMENT > __STDCPP_DEFAULT_NEW_ALIGNMENT__
 If this allocator needs to fall back to aligned allocations because JPH_RVECTOR_ALIGNMENT is bigger than the platform default.
 

Detailed Description

Default implementation of the temp allocator that allocates a large block through malloc upfront.

Constructor & Destructor Documentation

◆ TempAllocatorImpl()

JPH_OVERRIDE_NEW_DELETE TempAllocatorImpl::TempAllocatorImpl ( size_t inSize)
inlineexplicit

Constructs the allocator with a maximum allocatable size of inSize.

◆ ~TempAllocatorImpl()

virtual TempAllocatorImpl::~TempAllocatorImpl ( )
inlineoverridevirtual

Destructor, frees the block.

Member Function Documentation

◆ Allocate()

virtual void * TempAllocatorImpl::Allocate ( uint inSize)
inlineoverridevirtual

Allocates inSize bytes of memory, returned memory address must be JPH_RVECTOR_ALIGNMENT byte aligned.

Implements TempAllocator.

◆ CanAllocate()

bool TempAllocatorImpl::CanAllocate ( uint inSize) const
inline

Check if an allocation of inSize can be made in this fixed buffer allocator.

◆ Free()

virtual void TempAllocatorImpl::Free ( void * inAddress,
uint inSize )
inlineoverridevirtual

Frees inSize bytes of memory located at inAddress.

Implements TempAllocator.

◆ GetSize()

size_t TempAllocatorImpl::GetSize ( ) const
inline

Get the total size of the fixed buffer.

◆ GetUsage()

size_t TempAllocatorImpl::GetUsage ( ) const
inline

Get current usage in bytes of the buffer.

◆ IsEmpty()

bool TempAllocatorImpl::IsEmpty ( ) const
inline

Check if no allocations have been made.

◆ OwnsMemory()

bool TempAllocatorImpl::OwnsMemory ( const void * inAddress) const
inline

Check if memory block at inAddress is owned by this allocator.


The documentation for this class was generated from the following file: