Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
TempAllocator Class Referenceabstract

#include <TempAllocator.h>

Inheritance diagram for TempAllocator:
NonCopyable TempAllocatorImpl TempAllocatorImplWithMallocFallback TempAllocatorMalloc

Public Member Functions

virtual ~TempAllocator ()=default
 Destructor.
 
virtual void * Allocate (uint inSize)=0
 Allocates inSize bytes of memory, returned memory address must be alignment_size byte aligned.
 
virtual void Free (void *inAddress, uint inSize)=0
 Frees inSize bytes of memory located at inAddress.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Static Public Attributes

static JPH_OVERRIDE_NEW_DELETE constexpr uint alignment_size = max(JPH_VECTOR_ALIGNMENT, JPH_RVECTOR_ALIGNMENT)
 Alignment of the allocations made by this allocator.
 
static constexpr bool needs_aligned_allocate = alignment_size > JPH_DEFAULT_ALLOCATE_ALIGNMENT
 If this allocator needs to fall back to aligned allocations because alignment_size is bigger than the platform default.
 

Detailed Description

Allocator for temporary allocations. This allocator works as a stack: The blocks must always be freed in the reverse order as they are allocated. Note that allocations and frees can take place from different threads, but the order is guaranteed though job dependencies, so it is not needed to use any form of locking.

Constructor & Destructor Documentation

◆ ~TempAllocator()

virtual TempAllocator::~TempAllocator ( )
virtualdefault

Destructor.

Member Function Documentation

◆ Allocate()

virtual void * TempAllocator::Allocate ( uint inSize)
pure virtual

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

Implemented in TempAllocatorImpl, TempAllocatorImplWithMallocFallback, and TempAllocatorMalloc.

◆ Free()

virtual void TempAllocator::Free ( void * inAddress,
uint inSize )
pure virtual

Frees inSize bytes of memory located at inAddress.

Implemented in TempAllocatorImpl, TempAllocatorImplWithMallocFallback, and TempAllocatorMalloc.

Member Data Documentation

◆ alignment_size

JPH_OVERRIDE_NEW_DELETE constexpr uint TempAllocator::alignment_size = max(JPH_VECTOR_ALIGNMENT, JPH_RVECTOR_ALIGNMENT)
staticconstexpr

Alignment of the allocations made by this allocator.

◆ needs_aligned_allocate

bool TempAllocator::needs_aligned_allocate = alignment_size > JPH_DEFAULT_ALLOCATE_ALIGNMENT
staticconstexpr

If this allocator needs to fall back to aligned allocations because alignment_size is bigger than the platform default.


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