spot
2.9
|
A fixed-size memory pool implementation. More...
#include <spot/misc/fixpool.hh>
Public Member Functions | |
fixed_size_pool (size_t size) | |
Create a pool allocating objects of size bytes. More... | |
~fixed_size_pool () | |
Free any memory allocated by this pool. More... | |
void * | allocate () |
Allocate size bytes of memory. More... | |
void | deallocate (void *ptr) |
Recycle size bytes of memory. More... | |
A fixed-size memory pool implementation.
spot::fixed_size_pool::fixed_size_pool | ( | size_t | size | ) |
Create a pool allocating objects of size bytes.
|
inline |
Free any memory allocated by this pool.
|
inline |
Allocate size bytes of memory.
|
inline |
Recycle size bytes of memory.
Despite the name, the memory is not really deallocated in the "delete" sense: it is still owned by the pool and will be reused by allocate as soon as possible. The memory is only freed when the pool is destroyed.