join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicArena< Backend, Count, Sizes > Class Template Reference

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.
 
BasicArenaoperator= (const BasicArena &other)=delete
 copy assignment operator.
 
 BasicArena (BasicArena &&other) noexcept
 move constructor.
 
BasicArenaoperator= (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.
 
int mbind (int numa) const noexcept
 bind memory to a NUMA node.
 
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.
 

Detailed Description

template<typename Backend, size_t Count, size_t... Sizes>
class join::BasicArena< Backend, Count, Sizes >

memory arena owning backend and managing one or more pools.

allocator forward declarations.

Constructor & Destructor Documentation

◆ BasicArena() [1/3]

template<typename Backend , size_t Count, size_t... Sizes>
template<typename... Args>
join::BasicArena< Backend, Count, Sizes >::BasicArena ( Args &&... args)
inline

create instance.

Parameters
argsarguments forwarded to the backend.

◆ BasicArena() [2/3]

template<typename Backend , size_t Count, size_t... Sizes>
join::BasicArena< Backend, Count, Sizes >::BasicArena ( const BasicArena< Backend, Count, Sizes > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicArena() [3/3]

template<typename Backend , size_t Count, size_t... Sizes>
join::BasicArena< Backend, Count, Sizes >::BasicArena ( BasicArena< Backend, Count, Sizes > && other)
inlinenoexcept

move constructor.

Parameters
otherother object to move.

◆ ~BasicArena()

template<typename Backend , size_t Count, size_t... Sizes>
join::BasicArena< Backend, Count, Sizes >::~BasicArena ( )
default

destroy instance.

Member Function Documentation

◆ allocate()

template<typename Backend , size_t Count, size_t... Sizes>
void * join::BasicArena< Backend, Count, Sizes >::allocate ( size_t size)
inlinenoexcept

allocate memory from the first pool that fits (promotes if exhausted).

Parameters
sizesize of the allocation request in bytes.
Returns
pointer to the allocated memory, or nullptr on failure.

◆ deallocate()

template<typename Backend , size_t Count, size_t... Sizes>
void join::BasicArena< Backend, Count, Sizes >::deallocate ( void * p)
inlinenoexcept

return memory to the appropriate pool.

Parameters
ppointer to the memory to return.

◆ mbind()

template<typename Backend , size_t Count, size_t... Sizes>
int join::BasicArena< Backend, Count, Sizes >::mbind ( int numa) const
inlinenoexcept

bind memory to a NUMA node.

Parameters
numaNUMA node ID.
Returns
0 on success, -1 on failure.

◆ mlock()

template<typename Backend , size_t Count, size_t... Sizes>
int join::BasicArena< Backend, Count, Sizes >::mlock ( ) const
inlinenoexcept

lock memory in RAM.

Returns
0 on success, -1 on failure.

◆ operator=() [1/2]

template<typename Backend , size_t Count, size_t... Sizes>
BasicArena & join::BasicArena< Backend, Count, Sizes >::operator= ( BasicArena< Backend, Count, Sizes > && other)
inlinenoexcept

move assignment operator.

Parameters
otherother object to move.
Returns
this.

◆ operator=() [2/2]

template<typename Backend , size_t Count, size_t... Sizes>
BasicArena & join::BasicArena< Backend, Count, Sizes >::operator= ( const BasicArena< Backend, Count, Sizes > & other)
delete

copy assignment operator.

Parameters
otherother object to copy.

◆ tryAllocate()

template<typename Backend , size_t Count, size_t... Sizes>
void * join::BasicArena< Backend, Count, Sizes >::tryAllocate ( size_t size)
inlinenoexcept

allocate memory from the exact pool that fits, without promotion.

Parameters
sizesize of the allocation request in bytes.
Returns
pointer to the allocated memory, or nullptr on failure.

Member Data Documentation

◆ _total

template<typename Backend , size_t Count, size_t... Sizes>
size_t join::BasicArena< Backend, Count, Sizes >::_total = TotalSize<Count, Sizes...>::value
staticconstexpr

total bytes required in the mapped region.


The documentation for this class was generated from the following files: