Flow
Documentation for the Flow C++ Library
|
A pool memory resource that manages fixed-size memory blocks from a pre-allocated buffer. The allocation size must be less or equal to the block size. The allocation alignment must be less or equal to the block alignment. Throws std::bad_alloc if the constraint is not met or run out of memory. More...
#include <flow_pool_memory_resource.h>
Classes | |
struct | Header |
Public Member Functions | |
PoolMemoryResource (void *buffer, std::size_t capacity, std::size_t blockSize, std::size_t blockAlignment=sizeof(std::max_align_t)) | |
~PoolMemoryResource () | |
Public Member Functions inherited from flow::MemoryResource | |
virtual | ~MemoryResource ()=default |
void * | allocate (std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
void | deallocate (void *address, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) |
Protected Member Functions | |
virtual void * | allocateImp (std::size_t bytes, std::size_t alignment) override |
virtual void | deallocateImp (void *address, std::size_t bytes, std::size_t alignment) override |
Protected Attributes | |
std::size_t | blockSize_ |
std::size_t | blockAlignment_ |
Header * | head_ |
A pool memory resource that manages fixed-size memory blocks from a pre-allocated buffer. The allocation size must be less or equal to the block size. The allocation alignment must be less or equal to the block alignment. Throws std::bad_alloc if the constraint is not met or run out of memory.
Definition at line 14 of file flow_pool_memory_resource.h.
|
inline |
Definition at line 16 of file flow_pool_memory_resource.h.
References flow::alignWithHeader(), blockAlignment_, blockSize_, head_, and flow::PoolMemoryResource::Header::next.
|
inline |
|
inlineoverrideprotectedvirtual |
Implements flow::MemoryResource.
Definition at line 53 of file flow_pool_memory_resource.h.
References blockAlignment_, blockSize_, and head_.
|
inlineoverrideprotectedvirtual |
Implements flow::MemoryResource.
Definition at line 63 of file flow_pool_memory_resource.h.
References head_, and flow::PoolMemoryResource::Header::next.
|
protected |
Definition at line 50 of file flow_pool_memory_resource.h.
Referenced by allocateImp(), and PoolMemoryResource().
|
protected |
Definition at line 49 of file flow_pool_memory_resource.h.
Referenced by allocateImp(), and PoolMemoryResource().
|
protected |
Definition at line 51 of file flow_pool_memory_resource.h.
Referenced by allocateImp(), deallocateImp(), PoolMemoryResource(), and ~PoolMemoryResource().