|
join 1.0
lightweight network framework library
|
memory arena owning backend and managing one or more pools. More...
#include <allocator.hpp>
Public Member Functions | |
| template<typename... Args> | |
| BasicArena (Args &&... args) | |
| create instance. | |
| BasicArena (const BasicArena &other)=delete | |
| copy constructor. | |
| BasicArena & | operator= (const BasicArena &other)=delete |
| copy assignment operator. | |
| BasicArena (BasicArena &&other) noexcept | |
| move constructor. | |
| BasicArena & | operator= (BasicArena &&other) noexcept |
| move assignment operator. | |
| ~BasicArena ()=default | |
| destroy instance. | |
| void * | allocate (size_t size) noexcept |
| allocate memory from the first pool that fits (promotes if exhausted). | |
| void * | tryAllocate (size_t size) noexcept |
| allocate memory from the exact pool that fits, without promotion. | |
| void | deallocate (void *p) noexcept |
| return memory to the appropriate pool. | |
| bool | hasBackend () const noexcept |
| check if the arena still owns a memory region. | |
| template<size_t I = 0> | |
| uint32_t | getIndex (void *p) const noexcept |
| get the index of a chunk in the pool. | |
| template<size_t I = 0> | |
| void * | getPtr (uint32_t idx) const noexcept |
| get the pointer to a chunk by index. | |
| template<size_t I = 0> | |
| bool | reserveAll () noexcept |
| reserve all chunks of a pool at once. | |
| template<size_t I = 0> | |
| void | releaseAll () noexcept |
| release all chunks of a pool at once. | |
| int | mlock () const noexcept |
| lock memory in RAM. | |
Static Public Attributes | |
| static constexpr size_t | _total = TotalSize<Count, Sizes...>::value |
| total bytes required in the mapped region. | |
memory arena owning backend and managing one or more pools.
allocator forward declarations.
|
inline |
create instance.
| args | arguments forwarded to the backend. |
|
delete |
copy constructor.
| other | other object to copy. |
|
inlinenoexcept |
move constructor.
| other | other object to move. |
|
default |
destroy instance.
|
inlinenoexcept |
allocate memory from the first pool that fits (promotes if exhausted).
| size | size of the allocation request in bytes. |
|
inlinenoexcept |
return memory to the appropriate pool.
| p | pointer to the memory to return. |
|
inlinenoexcept |
get the index of a chunk in the pool.
| p | pointer to the chunk (must be owned by the pool). |
|
inlinenoexcept |
get the pointer to a chunk by index.
| idx | index of the chunk (must be in range). |
|
inlinenoexcept |
check if the arena still owns a memory region.
|
inlinenoexcept |
lock memory in RAM.
|
inlinenoexcept |
move assignment operator.
| other | other object to move. |
|
delete |
copy assignment operator.
| other | other object to copy. |
|
inlinenoexcept |
release all chunks of a pool at once.
|
inlinenoexcept |
reserve all chunks of a pool at once.
|
inlinenoexcept |
allocate memory from the exact pool that fits, without promotion.
| size | size of the allocation request in bytes. |
|
staticconstexpr |
total bytes required in the mapped region.