51 return total > 0 ?
static_cast<double>(
pool_hits) / total : 0.0;
82#if CONTAINER_USE_MEMORY_POOL
101 return ::operator
new(size, std::nothrow);
116#if CONTAINER_USE_MEMORY_POOL
126 ::operator
delete(ptr);
184template<
typename T,
typename... Args>
186 static_assert(std::is_nothrow_destructible_v<T>,
187 "pool_allocate requires nothrow destructible types");
195 return new (ptr) T(std::forward<Args>(args)...);
statistics get_statistics() const
Get current pool statistics.
Thread-local pool manager for value_container allocations.
pool_allocator_stats stats_
static pool_allocator & instance() noexcept
Get the singleton instance.
pool_allocator_stats get_stats() const noexcept
Get allocation statistics.
fixed_block_pool medium_pool_
fixed_block_pool 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)
pool_allocator & operator=(const pool_allocator &)=delete
pool_allocator(const pool_allocator &)=delete
void deallocate(void *ptr, std::size_t size) noexcept
Deallocate memory to the appropriate pool.
pool_allocator(pool_allocator &&)=delete
pool_allocator & operator=(pool_allocator &&)=delete
fixed_block_pool::statistics get_small_pool_stats() const
Get statistics from the small pool.
void * allocate(std::size_t size) noexcept
Allocate memory from the appropriate pool.
constexpr bool is_pool_allocatable() noexcept
Check if a type is suitable for pool allocation.
void pool_deallocate(T *ptr) noexcept
Destroy and deallocate an object allocated with pool_allocate.
constexpr int get_size_class(std::size_t size) noexcept
Get the size class for a given size.
T * pool_allocate(Args &&... args) noexcept
Allocate and construct an object using pool allocation.
Statistics for monitoring memory pool usage.
Extended pool statistics with hit/miss tracking.
std::size_t small_pool_allocs
std::size_t deallocations
double hit_rate() const noexcept
std::size_t medium_pool_allocs
Size class thresholds for pool allocation.
static constexpr std::size_t medium_threshold
static constexpr std::size_t blocks_per_chunk
static constexpr std::size_t small_threshold