Arena allocator to preallocate memory for IOCP events. More...
#include <iocp.hpp>
Public Member Functions | |
T * | allocate () |
void | deallocate (T *obj) |
int | count () const |
Arena allocator to preallocate memory for IOCP events.
This class implements an arena allocator that preallocates memory in blocks (of size PoolSize
) to avoid individual heap allocations for each IOCP event structure. This is necessary for efficiency when working with the IOCP API, which may require frequent allocation and deallocation of event objects.
T | The type of object to allocate (e.g. IOCP event structure). |
PoolSize | The number of objects in each preallocated pool (default is 1024). |