ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::MemoryManager Class Reference

The memory manager is used to store the different memory allocators that are used by the library. More...

#include <include/reactphysics3d/memory/MemoryManager.h>

Public Types

enum class  AllocationType { Base , Pool , Heap , Frame }
 Memory allocation types.
 

Public Member Functions

 MemoryManager (MemoryAllocator *baseAllocator, size_t initAllocatedMemory=0)
 Constructor.
 
 ~MemoryManager ()=default
 Destructor.
 
void * allocate (AllocationType allocationType, size_t size)
 Allocate memory of a given type.
 
void release (AllocationType allocationType, void *pointer, size_t size)
 Release previously allocated memory.
 
PoolAllocatorgetPoolAllocator ()
 Return the pool allocator.
 
SingleFrameAllocatorgetSingleFrameAllocator ()
 Return the single frame stack allocator.
 
HeapAllocatorgetHeapAllocator ()
 Return the heap allocator.
 
void resetFrameAllocator ()
 Reset the single frame allocator.
 

Detailed Description

The memory manager is used to store the different memory allocators that are used by the library.

The base allocator is either the default allocator (malloc/free) of a custom allocated specified by the user. The HeapAllocator is used on top of the base allocator. The SingleFrameAllocator is used for memory that is allocated only during a frame and the PoolAllocator is used to allocated objects of small size. Both SingleFrameAllocator and PoolAllocator will fall back to HeapAllocator if an allocation request cannot be fulfilled.


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