#include <p6mempool.h>
Inherits P6R::p6ICom.
Public Member Functions | |
virtual P6INT32 | addref (void)=0 |
virtual P6R::P6ERR | alloc (P6VOID **ppMem)=0 |
virtual P6R::P6ERR | free (P6VOID *pMem)=0 |
virtual P6R::P6ERR | getName (P6WCHAR *pBuffer, P6UINT32 *pcBuffer)=0 |
virtual P6R::P6ERR | getStats (P6UINT32 *pcBlock, P6UINT32 *pcActual, P6UINT32 *pcInitial, P6UINT32 *pcGrowby, P6UINT32 *pcTotal, P6UINT32 *pcFree, P6UINT32 *pcHighWater)=0 |
virtual P6R::P6ERR | initialize (MEMPOOLFLGS nFlags, P6UINT32 cPageSize, P6UINT32 cInitialCount, P6UINT32 cGrowBy, const P6WCHAR *pszName)=0 |
virtual P6R::P6ERR | isOwned (P6VOID *pMem)=0 |
virtual P6R::P6ERR | queryInterface (const P6R::P6IID &iid, P6VOID **ppIface)=0 |
virtual P6INT32 | release (void)=0 |
This is a fixed size memory allocator.
If the pool is sized correctly, it performs constant time allocation and deallocation of blocks.
Memory pool should be used in situations where the allocation requirements are know a priori. A correctly sized pool will never grow except under exceptional circumstances.
Memory pools reduce heap fragmentation by drastically reducing the number of heap allocations. Typically, once allocated, a block is never freed. The advantage of ths is that since memory is allocated on from the global heap once, there is no problem with the non-deterministic timing of dynamic memory allocation and heap defragmentation during runtime. The result is that all allocations and frees have much more deterministic timing which does not degrade over time.
Definition at line 66 of file p6mempool.h.