ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches
buffer_pool.c File Reference

💾 Lock-free memory pool with atomic operations More...

Go to the source code of this file.

Functions

buffer_pool_tbuffer_pool_create (size_t max_bytes, uint64_t shrink_delay_ms)
 Create a new buffer pool.
 
void buffer_pool_destroy (buffer_pool_t *pool)
 Destroy a buffer pool and free all memory.
 
void * buffer_pool_alloc (buffer_pool_t *pool, size_t size)
 Allocate a buffer from the pool (lock-free fast path)
 
void buffer_pool_free (buffer_pool_t *pool, void *data, size_t size)
 Free a buffer back to the pool (lock-free)
 
void buffer_pool_shrink (buffer_pool_t *pool)
 Force shrink the pool (free old unused buffers)
 
void buffer_pool_get_stats (buffer_pool_t *pool, size_t *current_bytes, size_t *used_bytes, size_t *free_bytes)
 Get pool statistics (atomic reads)
 
void buffer_pool_log_stats (buffer_pool_t *pool, const char *name)
 Log pool statistics.
 
void buffer_pool_init_global (void)
 
void buffer_pool_cleanup_global (void)
 
buffer_pool_tbuffer_pool_get_global (void)
 

Detailed Description

💾 Lock-free memory pool with atomic operations

Definition in file buffer_pool.c.