Dillo
Public Member Functions | Private Attributes | List of all members
lout::misc::ZoneAllocator Class Reference

A simple allocator optimized to handle many small chunks of memory. The chunks can not be free'd individually. Instead the whole zone must be free'd with zoneFree(). More...

#include <misc.hh>

Public Member Functions

 ZoneAllocator (size_t poolSize)
 
 ~ZoneAllocator ()
 
void * zoneAlloc (size_t t)
 
void zoneFree ()
 
const char * strndup (const char *str, size_t t)
 
const char * strdup (const char *str)
 

Private Attributes

size_t poolSize
 
size_t poolLimit
 
size_t freeIdx
 
SimpleVector< char * > * pools
 
SimpleVector< char * > * bulk
 

Detailed Description

A simple allocator optimized to handle many small chunks of memory. The chunks can not be free'd individually. Instead the whole zone must be free'd with zoneFree().

Constructor & Destructor Documentation

lout::misc::ZoneAllocator::ZoneAllocator ( size_t  poolSize)
inline

References poolSize.

lout::misc::ZoneAllocator::~ZoneAllocator ( )
inline

References bulk, pools, and zoneFree().

Member Function Documentation

const char* lout::misc::ZoneAllocator::strdup ( const char *  str)
inline

References strndup().

const char* lout::misc::ZoneAllocator::strndup ( const char *  str,
size_t  t 
)
inline

References zoneAlloc().

Referenced by strdup().

void* lout::misc::ZoneAllocator::zoneAlloc ( size_t  t)
inline
void lout::misc::ZoneAllocator::zoneFree ( )
inline

Member Data Documentation

SimpleVector<char*>* lout::misc::ZoneAllocator::bulk
private

Referenced by ~ZoneAllocator().

size_t lout::misc::ZoneAllocator::freeIdx
private
size_t lout::misc::ZoneAllocator::poolLimit
private
SimpleVector<char*>* lout::misc::ZoneAllocator::pools
private

Referenced by ~ZoneAllocator().

size_t lout::misc::ZoneAllocator::poolSize
private

Referenced by ZoneAllocator(), and zoneFree().


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