Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
pool_allocator.h File Reference

Thread-local memory pool allocator for value_container. More...

#include "memory_pool.h"
#include <cstddef>
#include <atomic>
#include <new>
#include <type_traits>
#include <utility>
Include dependency graph for pool_allocator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  kcenon::container::internal::pool_size_class
 Size class thresholds for pool allocation. More...
 
struct  kcenon::container::internal::pool_allocator_stats
 Extended pool statistics with hit/miss tracking. More...
 
class  kcenon::container::internal::pool_allocator
 Thread-local pool manager for value_container allocations. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::container
 
namespace  kcenon::container::internal
 

Functions

template<typename T , typename... Args>
T * kcenon::container::internal::pool_allocate (Args &&... args) noexcept
 Allocate and construct an object using pool allocation.
 
template<typename T >
void kcenon::container::internal::pool_deallocate (T *ptr) noexcept
 Destroy and deallocate an object allocated with pool_allocate.
 
template<typename T >
constexpr bool kcenon::container::internal::is_pool_allocatable () noexcept
 Check if a type is suitable for pool allocation.
 
constexpr int kcenon::container::internal::get_size_class (std::size_t size) noexcept
 Get the size class for a given size.
 

Detailed Description

Thread-local memory pool allocator for value_container.

Provides pool-based allocation for small objects to reduce malloc overhead and improve cache locality. Uses thread-local pools for lock-free fast path.

Size classes:

  • Small pool: <= 64 bytes
  • Medium pool: <= 256 bytes
  • Large: Direct heap allocation (bypasses pool)

Definition in file pool_allocator.h.