rutz::free_list_base Class Reference

Un-typesafe base class for maintaining a free-list memory pool. More...

#include <rutz/freelist.h>

Collaboration diagram for rutz::free_list_base:
Collaboration graph
[legend]

List of all members.

Classes

struct  node
 Free-node class for free-list memory pools.

Public Member Functions

 free_list_base (std::size_t size_check)
 Construct an (empty) free list.
void * allocate (std::size_t bytes)
 Allocate space for a new object.
void deallocate (void *space)
 Return an object to the free list.
void release_free_nodes ()
 Release all nodes currently on the free list (e.g. to conserve memory).
std::size_t alloc_size () const
 Query the chunk size that this freelist is for.
std::size_t num_allocations () const
 Query how many allocations have been made.

Detailed Description

Un-typesafe base class for maintaining a free-list memory pool.

Definition at line 46 of file freelist.h.


Constructor & Destructor Documentation

GVX_DBG_REGISTER rutz::free_list_base::free_list_base ( std::size_t  size_check  ) 

Construct an (empty) free list.

All objects from this list must be of size size_check.

Definition at line 42 of file freelist.cc.


Member Function Documentation

std::size_t rutz::free_list_base::alloc_size (  )  const [inline]

Query the chunk size that this freelist is for.

Definition at line 80 of file freelist.h.

void * rutz::free_list_base::allocate ( std::size_t  bytes  ) 

Allocate space for a new object.

If there are chunks available in the free list, one of those is returned; otherwise new memory is allocated with malloc() or equivalent.

Definition at line 48 of file freelist.cc.

void rutz::free_list_base::deallocate ( void *  space  ) 

Return an object to the free list.

Definition at line 61 of file freelist.cc.

std::size_t rutz::free_list_base::num_allocations (  )  const [inline]

Query how many allocations have been made.

Definition at line 83 of file freelist.h.

void rutz::free_list_base::release_free_nodes (  ) 

Release all nodes currently on the free list (e.g. to conserve memory).

Definition at line 68 of file freelist.cc.

Referenced by rutz::free_list< T >::release_free_nodes().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:44:43 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3