|
join 1.0
lightweight network framework library
|
bump allocator owning its backends. More...
#include <bump_allocator.hpp>
Public Member Functions | |
| template<typename... Args> | |
| BasicBumpAllocator (Args &&... args) | |
| create instance. | |
| BasicBumpAllocator (const BasicBumpAllocator &other)=delete | |
| copy constructor. | |
| BasicBumpAllocator & | operator= (const BasicBumpAllocator &other)=delete |
| copy assignment operator. | |
| BasicBumpAllocator (BasicBumpAllocator &&other) noexcept | |
| move constructor. | |
| BasicBumpAllocator & | operator= (BasicBumpAllocator &&other) noexcept |
| move assignment operator. | |
| ~BasicBumpAllocator () | |
| destroy instance. | |
| void * | allocate (size_t size) noexcept |
| allocate memory at the cursor, aligned on the largest power of 2 dividing size, up to max_align_t. | |
| void * | allocate (size_t size, size_t alignment) noexcept |
| allocate memory at the cursor with an explicit alignment. | |
| void | deallocate (void *p, size_t size) noexcept |
| release memory (no-op). | |
| void | reset () noexcept |
| release all allocations at once. | |
| size_t | used () const noexcept |
| get the number of bytes consumed in the current block, alignment padding included. | |
| bool | hasBackend () const noexcept |
| check if the bump allocator still owns a memory region. | |
| int | mlock () const noexcept |
| lock the current block in RAM. | |
Static Public Member Functions | |
| static constexpr size_t | capacity () noexcept |
| get the initial capacity. | |
bump allocator owning its backends.
|
inline |
create instance.
| args | arguments forwarded to the backend. |
| std::system_error | if the backend cannot be mapped. |
|
delete |
copy constructor.
| other | other object to copy. |
|
inlinenoexcept |
move constructor.
| other | other object to move. |
|
inline |
destroy instance.
|
inlinenoexcept |
allocate memory at the cursor, aligned on the largest power of 2 dividing size, up to max_align_t.
| size | size of the allocation request in bytes. |
|
inlinenoexcept |
allocate memory at the cursor with an explicit alignment.
| size | size of the allocation request in bytes. |
| alignment | alignment of the allocation, must be a power of 2. |
|
inlinestaticconstexprnoexcept |
get the initial capacity.
|
inlinenoexcept |
release memory (no-op).
| p | memory to release. |
| size | allocation size (ignored). |
|
inlinenoexcept |
check if the bump allocator still owns a memory region.
|
inlinenoexcept |
lock the current block in RAM.
|
inlinenoexcept |
move assignment operator.
| other | other object to move. |
|
delete |
copy assignment operator.
| other | other object to copy. |
|
inlinenoexcept |
release all allocations at once.
|
inlinenoexcept |
get the number of bytes consumed in the current block, alignment padding included.