libcoro
1.0
Coroutine support library for C++20
|
A corutine allocator that caches unused frames in the pool. More...
#include <pool_alloc.h>
Static Public Member Functions | |
static void * | alloc (std::size_t sz) |
allocate a block More... | |
static void | dealloc (void *ptr, std::size_t sz) |
deallocate block More... | |
A corutine allocator that caches unused frames in the pool.
The pool is implemented as a hash-map with a list of free frames. Whenever a corutine leaves its frame, it is inserted into the pool and is quickly released when a new frame is requested for allocation
Each thread has its own pool. This makes the allocation not using locking. Deallocations that are made in a thread other than the mother thread of the frame are registered in a lock-free list, which is then moved to the mother pool at the appropriate time
Definition at line 171 of file pool_alloc.h.