Sacado  Development
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Protected Attributes | List of all members
Sacado::Fad::MemPool Class Reference

Memory pool. More...

#include <Sacado_Fad_MemPool.hpp>

Collaboration diagram for Sacado::Fad::MemPool:
Collaboration graph
[legend]

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.
 
Chunkchunks
 Pointer to memory chunks.
 
Linkhead
 Pointer to first free link.
 
unsigned int num_chunks
 Number of allocated chunks.
 

Detailed Description

Memory pool.


The documentation for this class was generated from the following files: