Pool allocator for use only from the GUI thread to minimize memory fragmentation. More...
#include <UTGUIPoolAllocator.h>
Public Member Functions | |
GUIPoolAllocator_t () | |
~GUIPoolAllocator_t () | |
void * | Allocate (size_t size) |
void | Release (void *block) |
Non-core library: UTgui
GUI objects pool allocator implementation to minimize memory fragmentation. This class can only be used from the main (GUI) thread. A single global instance is provided as g_gui_pool_allocator. This should only be used for reasonably short-lived and frequently allocated objects, 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 libraries with TRACE_LEAKED_POOL_BLOCK to diagnose where the block was allocated. That facility is only available in debug builds.
Definition at line 41 of file UTGUIPoolAllocator.h.
GUIPoolAllocator_t::GUIPoolAllocator_t | ( | ) |
Constructor.
GUIPoolAllocator_t::~GUIPoolAllocator_t | ( | ) |
Destructor.
void * GUIPoolAllocator_t::Allocate | ( | size_t | size | ) | [inline] |
Allocates a block from the block pool.
Reimplemented from PoolAllocator_t.
Definition at line 92 of file UTGUIPoolAllocator.h.
void GUIPoolAllocator_t::Release | ( | void * | block | ) | [inline] |
Releases a block back to the block pool.
Reimplemented from PoolAllocator_t.
Definition at line 100 of file UTGUIPoolAllocator.h.