spot 2.13
|
A multiple-size memory pool implementation. More...
#include <spot/misc/mspool.hh>
Public Member Functions | |
multiple_size_pool () | |
Create a pool. More... | |
~multiple_size_pool () | |
Free any memory allocated by this pool. More... | |
size_t | fixsize (size_t size) const |
void * | allocate (size_t size) |
Allocate size bytes of memory. More... | |
void | deallocate (const void *ptr, size_t size) |
Recycle size bytes of memory. More... | |
A multiple-size memory pool implementation.
|
inline |
Create a pool.
|
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.
The size argument should be the same as the one passed to allocate().