PoolAllocator_t Class Reference

Pool allocator implementation to minimize memory fragmentation. More...

#include <UTPoolAllocator.h>

Inheritance diagram for PoolAllocator_t:
GUIPoolAllocator_t

List of all members.

Public Member Functions

 PoolAllocator_t (bool auto_thread_safe)
 ~PoolAllocator_t ()
void * Allocate (size_t size)
void Release (void *block)

Detailed Description

Pool allocator implementation to minimize memory fragmentation. This should only be used for objects, few of which are created or which are reasonably short-lived and frequently allocated, otherwise as pools are freed in an attempt to keep that memory fragmentation to a minimum, the old blocks will stay allocated and actually make matters worse. If a pool block has been leaked, build the UT library with TRACE_LEAKED_POOL_BLOCK to diagnose where the block was allocated. That facility is only available in debug builds.

Definition at line 60 of file UTPoolAllocator.h.


Constructor & Destructor Documentation

PoolAllocator_t::PoolAllocator_t ( bool  auto_thread_safe  ) 

Constructor. If auto_thread_safe is true, it will allocate a mutex and ensure that calls to Allocate and Release are thread safe.

PoolAllocator_t::~PoolAllocator_t (  ) 

Destructor.


Member Function Documentation

void* PoolAllocator_t::Allocate ( size_t  size  ) 

Allocates a block from the block pool.

Reimplemented in GUIPoolAllocator_t.

void PoolAllocator_t::Release ( void *  block  ) 

Releases a block back to the block pool.

Reimplemented in GUIPoolAllocator_t.


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

Generated on Tue Dec 14 22:35:07 2010 for UT library by  doxygen 1.6.1