ascii-chat 0.11.33
Video chat in your terminal
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_t * buffer_pool_create (size_t max_bytes, uint64_t shrink_delay_ns)
 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, const 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_t * buffer_pool_get_global (void)
 

Detailed Description

💾 Lock-free memory pool with atomic operations

Definition in file buffer_pool.c.

Variable Documentation

◆ lifecycle

lifecycle_t lifecycle

Definition at line 409 of file buffer_pool.c.

◆ mutex

mutex_t mutex

Definition at line 408 of file buffer_pool.c.

◆ pool