Public Member Functions | |
| void | removeBlockFromList (MemoryPoolSingleBlock **pHead) |
| void | initBlock (Int logicalSize, MemoryPoolBlob *owningBlob, MemoryPoolFactory *owningFactory DECLARE_LITERALSTRING_ARG2) |
| void * | getUserData () |
| MemoryPoolBlob * | getOwningBlob () |
| MemoryPoolSingleBlock * | getNextFreeBlock () |
| void | setNextFreeBlock (MemoryPoolSingleBlock *b) |
| MemoryPoolSingleBlock * | getNextRawBlock () |
| void | setNextRawBlock (MemoryPoolSingleBlock *b) |
Static Public Member Functions | |
| static Int | calcRawBlockSize (Int logicalSize) |
| static MemoryPoolSingleBlock * | rawAllocateSingleBlock (MemoryPoolSingleBlock **pRawListHead, Int logicalSize, MemoryPoolFactory *owningFactory DECLARE_LITERALSTRING_ARG2) |
| static MemoryPoolSingleBlock * | recoverBlockFromUserData (void *pUserData) |
This is the fundamental allocation unit; when you allocate via (say) MemoryPool::allocateBlock, this is what is being allocated for you. (Of course, you don't see the private fields.) For the most part, we allocate big chunks of these in a monolithic Blob and subdivide from there. (However, we occasionally allocate these individually, for large blocks.)
Note also that we directly allocate/free these with sysAllocate/sysFree, so ctors/dtors are never executed, nor would virtual functions work – I know, it's a little evil.
Definition at line 401 of file GameMemory.cpp.
given a desired logical block size, calculate the physical size needed for each MemoryPoolSingleBlock (including overhead, etc.)
Definition at line 563 of file GameMemory.cpp.
|
inline |
return the next free block in this blob. this call assumes that the block in question belongs to a blob, and will assert if not.
Definition at line 584 of file GameMemory.cpp.
|
inline |
return the next raw block in this dma. this call assumes that the block in question does NOT belong to a blob, and will assert if not.
Definition at line 612 of file GameMemory.cpp.
|
inline |
accessor
Definition at line 575 of file GameMemory.cpp.
|
inline |
return a ptr to the user-data area of the block (ie, the part the enduser can deal with). this call verifies that the block is valid in debug mode.
Definition at line 550 of file GameMemory.cpp.
| void MemoryPoolSingleBlock::initBlock | ( | Int | logicalSize, |
| MemoryPoolBlob * | owningBlob, | ||
| MemoryPoolFactory *owningFactory | DECLARE_LITERALSTRING_ARG2 ) |
fill in a block's fields. this is usually done only just after a block is allocated, but might also be done at other points in debug mode.
Definition at line 852 of file GameMemory.cpp.
|
static |
allocate and initialize a single block. this should only used by DynamicMemoryAllocator when allocating an extraordinarily large block.
Definition at line 928 of file GameMemory.cpp.
|
static |
given a 'public' ptr to a block (ie, the ptr returned by the MemoryPool::allocateBlock), recover the ptr to the MemoryPoolSingleBlock, so we can access the hidden fields.
Definition at line 906 of file GameMemory.cpp.
| void MemoryPoolSingleBlock::removeBlockFromList | ( | MemoryPoolSingleBlock ** | pHead | ) |
remove the block from the list, which is presumed to be a list of raw blocks. generally, only the DynamicMemoryAllocator should call this.
Definition at line 946 of file GameMemory.cpp.
|
inline |
set the next free block in this blob. this call assumes that both blocks in question belongs to a blob, but will NOT assert if not, since it may be called when the blocks are in an inconsistent state.
Definition at line 595 of file GameMemory.cpp.
|
inline |
set the next raw block in this dma. this call assumes that the blocks in question do NOT belong to a blob, and will assert if not.
Definition at line 622 of file GameMemory.cpp.