spot  0.8.2
Classes | Public Member Functions | Private Attributes
spot::fixed_size_pool Class Reference

A fixed-size memory pool implementation. More...

#include <misc/fixpool.hh>

Collaboration diagram for spot::fixed_size_pool:
Collaboration graph
[legend]

List of all members.

Classes

struct  block_
union  chunk_

Public Member Functions

 fixed_size_pool (size_t size)
 Create a pool allocating objects of size bytes.
 ~fixed_size_pool ()
 Free any memory allocated by this pool.
void * allocate ()
 Allocate size bytes of memory.
void deallocate (const void *ptr)
 Recycle size bytes of memory.

Private Attributes

size_t size_
struct
spot::fixed_size_pool::block_
freelist_
char * free_start_
char * free_end_
union
spot::fixed_size_pool::chunk_
chunklist_

Detailed Description

A fixed-size memory pool implementation.


Constructor & Destructor Documentation

spot::fixed_size_pool::fixed_size_pool ( size_t  size) [inline]

Create a pool allocating objects of size bytes.

References size_.

Free any memory allocated by this pool.

References chunklist_, and spot::fixed_size_pool::chunk_::prev.


Member Function Documentation

void* spot::fixed_size_pool::allocate ( ) [inline]
void spot::fixed_size_pool::deallocate ( const void *  ptr) [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.

References freelist_, and spot::fixed_size_pool::block_::next.


Member Data Documentation

Referenced by allocate(), and ~fixed_size_pool().

Referenced by allocate().

Referenced by allocate().

Referenced by allocate(), and deallocate().

size_t spot::fixed_size_pool::size_ [private]

Referenced by allocate(), and fixed_size_pool().


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

Please comment this page and report errors about it on the RefDocComments page.
Generated on Thu Jan 19 2012 19:33:04 for spot by doxygen 1.7.6.1