Sacado
Development
|
Memory pool. More...
#include <Sacado_Fad_MemPool.hpp>
Classes | |
struct | Chunk |
Represents a memory chunk. More... | |
struct | Link |
Represents a memory element. More... | |
Public Member Functions | |
MemPool (unsigned int elem_size, unsigned int n_elem, unsigned int pre_alloc=0) | |
Constructor. elem_size is the size of elements, n_elem is the number of elements per chunk. pre_alloc is the number of chunks to pre-allocate. | |
~MemPool () | |
Destructor. | |
void * | alloc () |
Allocate a new element. | |
void | free (void *b) |
Free an element. | |
unsigned int | numChunks () const |
Return number of allocated chunks. | |
Protected Attributes | |
const unsigned int | esize |
Size of elements in a chunk. | |
const unsigned int | n |
Number of elements per chunk. | |
const unsigned int | csize |
Size of memory chunks. | |
Chunk * | chunks |
Pointer to memory chunks. | |
Link * | head |
Pointer to first free link. | |
unsigned int | num_chunks |
Number of allocated chunks. | |
Memory pool.