This method is called to initialize the memory pool for use.
At this time the memory pool will attempt to allocate cInitial allocation units.
- Note
- When the last reference to the pool is released, all unallocated blocks in the pool will no longer be valid, their memory will be returned to the system. This allows for the freeing of large numbers of allocations without having to free each one individually.
- Parameters
-
nFlags | Initializations flags
MEMPOOL_NOFLAGS | |
MEMPOOL_ZEROMEM | Zero's memory contents on allocation. |
MEMPOOL_USEHEAP | Allocates and deallocates directly from the heap. |
MEMPOOL_SETFREEMEM | Specifies that freed blocks be is set to a specific value. |
MEMPOOL_ENABLEFENCES | Currently not implemnted. |
|
cPageSize | The allocation unit size in bytes. |
cInitialCount | The initial number of allocation units to allocate. |
cGrowBy | The number of allocation units to grow the pool by if it runs out of allocation units. This may be set to 0 to prevent the pool from growing. If set to 0 and alloc() is called when the pool is out of allocation units, and error of eNoMemory will be returned by p6IMemPool::alloc(). |
pszName | The name of this memory pool (usually the name of the block/size/or class). |
- Returns
Success | P6R::eOk | |
Failure | P6R::eInvalidArg | Invalid page size, initial size and/or growby value. |
P6R::eNoMemory | There was not enough memory to satisfy the request. This can happen when growby is non-zero and the system is out of memory. Also if growby is zero and there are no available blocks in the pool. |
Other valid P6R::P6ERR's | |