33#ifndef DART_COMMON_FREELISTALLOCATOR_HPP_
34#define DART_COMMON_FREELISTALLOCATOR_HPP_
67 size_t initialAllocation = 1048576 );
81 [[nodiscard]]
void*
allocate(
size_t bytes)
noexcept override;
84 void deallocate(
void* pointer,
size_t bytes)
override;
87 void print(std::ostream& os = std::cout,
int indent = 0)
const override;
112 bool isNextContiguous);
124 void split(
size_t sizeToSplit);
#define DART_STRING_TYPE(type_name)
Definition Castable.hpp:38
Most general heap memory allocator for allocating memory of various sizes.
Definition FreeListAllocator.hpp:57
bool allocateMemoryBlock(size_t sizeToAllocate)
Allocates a new memory block for sizeToAllocate bytes.
Definition FreeListAllocator.cpp:240
MemoryBlockHeader * mFirstMemoryBlock
Pointer to the first memory block.
Definition FreeListAllocator.hpp:148
MemoryAllocator & mBaseAllocator
The base allocator.
Definition FreeListAllocator.hpp:142
const MemoryAllocator & getBaseAllocator() const
Returns the base allocator.
Definition FreeListAllocator.cpp:108
size_t mTotalAllocatedSize
The total allocated size in bytes.
Definition FreeListAllocator.hpp:157
std::mutex mMutex
Mutex for private variables except the base allocator.
Definition FreeListAllocator.hpp:145
void print(std::ostream &os=std::cout, int indent=0) const override
Prints state of the memory allocator.
Definition FreeListAllocator.cpp:270
MemoryBlockHeader * mFreeBlock
Pointer to the current free memory block.
Definition FreeListAllocator.hpp:151
size_t mTotalAllocatedBlockSize
The total allocated block size in bytes.
Definition FreeListAllocator.hpp:154
void * allocate(size_t bytes) noexcept override
Allocates size bytes of uninitialized storage.
Definition FreeListAllocator.cpp:120
~FreeListAllocator() override
Destructor.
Definition FreeListAllocator.cpp:50
void deallocate(void *pointer, size_t bytes) override
Deallocates the storage referenced by the pointer p, which must be a pointer obtained by an earlier c...
Definition FreeListAllocator.cpp:198
Base class for std::allocator compatible allocators.
Definition MemoryAllocator.hpp:46
static MemoryAllocator & GetDefault()
Returns the default memory allocator.
Definition MemoryAllocator.cpp:41