|
Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
|
Thread-local pool manager for value_container allocations. More...
#include <pool_allocator.h>

Public Member Functions | |
| void * | allocate (std::size_t size) noexcept |
| Allocate memory from the appropriate pool. | |
| void | deallocate (void *ptr, std::size_t size) noexcept |
| Deallocate memory to the appropriate pool. | |
| pool_allocator_stats | get_stats () const noexcept |
| Get allocation statistics. | |
| fixed_block_pool::statistics | get_small_pool_stats () const |
| Get statistics from the small pool. | |
| fixed_block_pool::statistics | get_medium_pool_stats () const |
| Get statistics from the medium pool. | |
| void | reset_stats () noexcept |
| Reset statistics (for benchmarking) | |
Static Public Member Functions | |
| static pool_allocator & | instance () noexcept |
| Get the singleton instance. | |
Private Member Functions | |
| pool_allocator () | |
| pool_allocator (const pool_allocator &)=delete | |
| pool_allocator & | operator= (const pool_allocator &)=delete |
| pool_allocator (pool_allocator &&)=delete | |
| pool_allocator & | operator= (pool_allocator &&)=delete |
Private Attributes | |
| fixed_block_pool | small_pool_ |
| fixed_block_pool | medium_pool_ |
| pool_allocator_stats | stats_ |
Thread-local pool manager for value_container allocations.
Manages two size-class pools (small and medium) with thread-local instances for lock-free allocation on the fast path.
Definition at line 61 of file pool_allocator.h.
|
inlineprivate |
Definition at line 161 of file pool_allocator.h.
|
privatedelete |
|
privatedelete |
|
inlinenoexcept |
Allocate memory from the appropriate pool.
| size | Number of bytes to allocate |
Definition at line 77 of file pool_allocator.h.
References kcenon::container::internal::fixed_block_pool::allocate(), medium_pool_, kcenon::container::internal::pool_allocator_stats::medium_pool_allocs, kcenon::container::internal::pool_size_class::medium_threshold, kcenon::container::internal::pool_allocator_stats::pool_hits, kcenon::container::internal::pool_allocator_stats::pool_misses, small_pool_, kcenon::container::internal::pool_allocator_stats::small_pool_allocs, kcenon::container::internal::pool_size_class::small_threshold, and stats_.
Referenced by kcenon::container::internal::pool_allocate().


|
inlinenoexcept |
Deallocate memory to the appropriate pool.
| ptr | Pointer to deallocate |
| size | Size of the allocation |
Definition at line 109 of file pool_allocator.h.
References kcenon::container::internal::fixed_block_pool::deallocate(), kcenon::container::internal::pool_allocator_stats::deallocations, medium_pool_, kcenon::container::internal::pool_size_class::medium_threshold, small_pool_, kcenon::container::internal::pool_size_class::small_threshold, and stats_.
Referenced by kcenon::container::internal::pool_allocate(), and kcenon::container::internal::pool_deallocate().


|
inline |
Get statistics from the medium pool.
Definition at line 149 of file pool_allocator.h.
References kcenon::container::internal::fixed_block_pool::get_statistics(), and medium_pool_.

|
inline |
Get statistics from the small pool.
Definition at line 141 of file pool_allocator.h.
References kcenon::container::internal::fixed_block_pool::get_statistics(), and small_pool_.

|
inlinenoexcept |
Get allocation statistics.
Definition at line 133 of file pool_allocator.h.
References stats_.
|
inlinestaticnoexcept |
Get the singleton instance.
Definition at line 67 of file pool_allocator.h.
Referenced by kcenon::container::internal::pool_allocate(), and kcenon::container::internal::pool_deallocate().

|
privatedelete |
|
privatedelete |
|
inlinenoexcept |
Reset statistics (for benchmarking)
Definition at line 156 of file pool_allocator.h.
References stats_.
|
private |
Definition at line 173 of file pool_allocator.h.
Referenced by allocate(), deallocate(), and get_medium_pool_stats().
|
private |
Definition at line 172 of file pool_allocator.h.
Referenced by allocate(), deallocate(), and get_small_pool_stats().
|
private |
Definition at line 174 of file pool_allocator.h.
Referenced by allocate(), deallocate(), get_stats(), and reset_stats().