Dillo v3.1.1-117-gc0464026
Loading...
Searching...
No Matches
lout::misc::ZoneAllocator Class Reference

A simple allocator optimized to handle many small chunks of memory. 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().

Definition at line 630 of file misc.hh.

Constructor & Destructor Documentation

◆ ZoneAllocator()

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

Definition at line 638 of file misc.hh.

References poolSize.

◆ ~ZoneAllocator()

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

Definition at line 646 of file misc.hh.

References bulk, pools, and zoneFree().

Member Function Documentation

◆ strdup()

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

Definition at line 689 of file misc.hh.

References strndup().

Referenced by dw::TrieBuilder::insert(), and dw::Trie::load().

◆ strndup()

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

Definition at line 682 of file misc.hh.

References zoneAlloc().

Referenced by dw::Textblock::addText0(), dw::Textblock::hyphenateWord(), and strdup().

◆ zoneAlloc()

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

◆ zoneFree()

void lout::misc::ZoneAllocator::zoneFree ( )
inline

Member Data Documentation

◆ bulk

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

Definition at line 635 of file misc.hh.

Referenced by zoneAlloc(), zoneFree(), and ~ZoneAllocator().

◆ freeIdx

size_t lout::misc::ZoneAllocator::freeIdx
private

Definition at line 633 of file misc.hh.

Referenced by zoneAlloc(), and zoneFree().

◆ poolLimit

size_t lout::misc::ZoneAllocator::poolLimit
private

Definition at line 633 of file misc.hh.

Referenced by zoneAlloc().

◆ pools

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

Definition at line 634 of file misc.hh.

Referenced by zoneAlloc(), zoneFree(), and ~ZoneAllocator().

◆ poolSize

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

Definition at line 633 of file misc.hh.

Referenced by zoneAlloc(), ZoneAllocator(), and zoneFree().


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