Allocator Builder
Policy Based C++ Template Allocator Library
 All Classes Functions Variables Enumerations Enumerator Groups Pages
alb::v_100::shared_heap< Allocator, NumberOfChunks, ChunkSize > Class Template Reference

#include <shared_heap.hpp>

Public Types

using allocator = Allocator
 

Public Member Functions

 shared_heap (size_t numberOfChunks, size_t chunkSize) noexcept
 
 shared_heap (shared_heap &&x) noexcept
 
shared_heapoperator= (shared_heap &&x) noexcept
 
size_t number_of_chunk () const noexcept
 
size_t chunk_size () const noexcept
 
bool owns (const block &b) const noexcept
 
block allocate (size_t n) noexcept
 
void deallocate (block &b) noexcept
 
void deallocate_all () noexcept
 
bool reallocate (block &b, size_t n) noexcept
 
bool expand (block &b, size_t delta) noexcept
 

Static Public Attributes

static constexpr bool supports_truncated_deallocation = true
 
static constexpr unsigned alignment = Allocator::alignment
 

Detailed Description

template<class Allocator, size_t NumberOfChunks, size_t ChunkSize>
class alb::v_100::shared_heap< Allocator, NumberOfChunks, ChunkSize >

The SharedHeap implements a classic heap with a pre-allocated size of numberOfChunks_.value() * chunk_size_.value() It has a overhead of one bit per block and linear complexity for allocation and deallocation operations. It is thread safe, except the moment of instantiation. As far as possible only a shared lock + an atomic operation is used during the memory operations

Definition at line 49 of file shared_heap.hpp.


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