33#ifndef DART_COMMON_MEMORYMANAGER_HPP_
34#define DART_COMMON_MEMORYMANAGER_HPP_
127 template <
typename T,
typename... Args>
132 template <
typename T,
typename... Args>
137 template <
typename T,
typename... Args>
141 template <
typename T>
146 template <
typename T>
151 template <
typename T>
156 [[nodiscard]]
bool hasAllocated(
void* pointer,
size_t size)
const noexcept;
160 void print(std::ostream& os = std::cout,
int indent = 0)
const;
std::string type
Definition SdfParser.cpp:82
Most general heap memory allocator for allocating memory of various sizes.
Definition FreeListAllocator.hpp:57
Base class for std::allocator compatible allocators.
Definition MemoryAllocator.hpp:46
static MemoryAllocator & GetDefault()
Returns the default memory allocator.
Definition MemoryAllocator.cpp:41
A composite memory allocator that contains various memory allocators that are optimized for different...
Definition MemoryManager.hpp:49
bool hasAllocated(void *pointer, size_t size) const noexcept
Returns true if a pointer is allocated by the internal allocator.
Definition MemoryManager.cpp:151
~MemoryManager()
Destructor.
Definition MemoryManager.cpp:62
void * allocateUsingFree(size_t bytes)
Allocates size bytes of uninitialized storage using FreeListAllocator.
Definition MemoryManager.cpp:109
static MemoryManager & GetDefault()
Returns the default memory manager.
Definition MemoryManager.cpp:42
T * constructUsingPool(Args &&... args) noexcept
Allocates uninitialized storage using PoolAllocator and constructs an object of type T to the allocat...
Definition MemoryManager-impl.hpp:74
void destroyUsingPool(T *pointer) noexcept
Calls the destructor of the object and deallocate the storage using PoolAllocator.
Definition MemoryManager-impl.hpp:100
MemoryAllocator & getBaseAllocator()
Returns the base allocator.
Definition MemoryManager.cpp:68
FreeListAllocator & getFreeListAllocator()
Returns the free list allocator.
Definition MemoryManager.cpp:74
void * allocate(Type type, size_t bytes)
Allocates size bytes of uninitialized storage.
Definition MemoryManager.cpp:94
PoolAllocator & getPoolAllocator()
Returns the pool allocator.
Definition MemoryManager.cpp:84
MemoryAllocator & mBaseAllocator
The base allocator to allocate memory chunck.
Definition MemoryManager.hpp:168
void print(std::ostream &os=std::cout, int indent=0) const
Prints state of the memory manager.
Definition MemoryManager.cpp:164
FreeListAllocator::Debug mFreeListAllocator
The free list allocator.
Definition MemoryManager.hpp:178
void * allocateUsingPool(size_t bytes)
Allocates size bytes of uninitialized storage using PoolAllocator.
Definition MemoryManager.cpp:115
T * construct(Type type, Args &&... args) noexcept
Allocates uninitialized storage and constructs an object of type T to the allocated storage.
Definition MemoryManager-impl.hpp:42
void deallocate(Type type, void *pointer, size_t bytes)
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier c...
Definition MemoryManager.cpp:121
Type
Type of the memory allocators.
Definition MemoryManager.hpp:53
PoolAllocator::Debug mPoolAllocator
The pool allocator.
Definition MemoryManager.hpp:181
friend std::ostream & operator<<(std::ostream &os, const MemoryManager &memoryManager)
Prints state of the memory manager.
Definition MemoryManager.cpp:180
void deallocateUsingPool(void *pointer, size_t bytes)
Definition MemoryManager.cpp:144
void destroy(Type type, T *object) noexcept
Calls the destructor of the object and deallocate the storage.
Definition MemoryManager-impl.hpp:81
void destroyUsingFree(T *pointer) noexcept
Calls the destructor of the object and deallocate the storage using FreeListAllocator.
Definition MemoryManager-impl.hpp:93
T * constructUsingFree(Args &&... args) noexcept
Allocates uninitialized storage using FreeListAllocator and constructs an object of type T to the all...
Definition MemoryManager-impl.hpp:67
void deallocateUsingFree(void *pointer, size_t bytes)
Definition MemoryManager.cpp:138
Memory allocator optimized for allocating many objects of the same or similar sizes.
Definition PoolAllocator.hpp:47