ReactPhysics3D
v0.10.2
C++ Physics engine library
|
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. | |
PoolAllocator & | getPoolAllocator () |
Return the pool allocator. | |
SingleFrameAllocator & | getSingleFrameAllocator () |
Return the single frame stack allocator. | |
HeapAllocator & | getHeapAllocator () |
Return the heap allocator. | |
void | resetFrameAllocator () |
Reset the single frame allocator. | |
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.