|
unilink
0.4.3
A simple C++ library for unified async communication
|
Selective simplified memory pool with optimized performance. More...
#include <memory_pool.hpp>
Classes | |
| struct | HealthMetrics |
| struct | PoolStats |
Public Types | |
| enum class | BufferSize : size_t { SMALL = 1024 , MEDIUM = 4096 , LARGE = 16384 , XLARGE = 65536 } |
Public Member Functions | |
| MemoryPool (size_t initial_pool_size=400, size_t max_pool_size=2000) | |
| ~MemoryPool ()=default | |
| MemoryPool (const MemoryPool &)=delete | |
| MemoryPool & | operator= (const MemoryPool &)=delete |
| MemoryPool (MemoryPool &&)=delete | |
| MemoryPool & | operator= (MemoryPool &&)=delete |
| std::unique_ptr< uint8_t[]> | acquire (size_t size) |
| std::unique_ptr< uint8_t[]> | acquire (BufferSize buffer_size) |
| void | release (std::unique_ptr< uint8_t[]> buffer, size_t size) |
| PoolStats | get_stats () const |
| double | get_hit_rate () const |
| void | cleanup_old_buffers (std::chrono::milliseconds max_age=std::chrono::minutes(5)) |
| std::pair< size_t, size_t > | get_memory_usage () const |
| void | resize_pool (size_t new_size) |
| void | auto_tune () |
| HealthMetrics | get_health_metrics () const |
Selective simplified memory pool with optimized performance.
Core design principles:
Definition at line 43 of file memory_pool.hpp.
|
strong |
| Enumerator | |
|---|---|
| SMALL | |
| MEDIUM | |
| LARGE | |
| XLARGE | |
Definition at line 57 of file memory_pool.hpp.
|
explicit |
Definition at line 32 of file memory_pool.cc.
|
default |
|
delete |
|
delete |
| std::unique_ptr< uint8_t[]> unilink::memory::MemoryPool::acquire | ( | BufferSize | buffer_size | ) |
Definition at line 67 of file memory_pool.cc.
| std::unique_ptr< uint8_t[]> unilink::memory::MemoryPool::acquire | ( | size_t | size | ) |
Definition at line 51 of file memory_pool.cc.
| void unilink::memory::MemoryPool::auto_tune | ( | ) |
Definition at line 117 of file memory_pool.cc.
| void unilink::memory::MemoryPool::cleanup_old_buffers | ( | std::chrono::milliseconds | max_age = std::chrono::minutes(5) | ) |
Definition at line 100 of file memory_pool.cc.
| MemoryPool::HealthMetrics unilink::memory::MemoryPool::get_health_metrics | ( | ) | const |
Definition at line 121 of file memory_pool.cc.
| double unilink::memory::MemoryPool::get_hit_rate | ( | ) | const |
Definition at line 92 of file memory_pool.cc.
| std::pair< size_t, size_t > unilink::memory::MemoryPool::get_memory_usage | ( | ) | const |
Definition at line 105 of file memory_pool.cc.
| MemoryPool::PoolStats unilink::memory::MemoryPool::get_stats | ( | ) | const |
Definition at line 85 of file memory_pool.cc.
|
delete |
|
delete |
| void unilink::memory::MemoryPool::release | ( | std::unique_ptr< uint8_t[]> | buffer, |
| size_t | size | ||
| ) |
Definition at line 71 of file memory_pool.cc.
| void unilink::memory::MemoryPool::resize_pool | ( | size_t | new_size | ) |
Definition at line 112 of file memory_pool.cc.