52 void Init(
const char *pszName,
int nNum,
int *pStart,
int nSizeWords,
int bHandles);
75 void GetInfo(
int *pnBlocks,
int *pnFreeBytes,
int *pnBiggest);
102 void *
Alloc(
int nSizeWords,
const char *pszTag,
int nAlignShift,
int *pnSizeWords);
116 void *
Realloc(
void *pData,
int nSizeWords,
int *pnSizeWords);
Free block of a Heap, a node of the heap's free list in address order.
Definition heap.h:10
int mSizeWords
Definition heap.h:22
bool Merge(FreeBlock *pNext)
Absorb the free block that starts where this one ends.
FreeBlock * mNext
Definition heap.h:23
Region of memory that hands out word-aligned blocks from a free list, best fit first.
Definition heap.h:38
void FindNeighbors(void *pAddress, FreeBlock **ppPrev, FreeBlock **ppNext)
Find the free blocks on each side of an address.
int * GetStart() const
Definition heap.h:171
void Resize(int nSizeWords)
Change the size of the heap, growing or shrinking its last free block.
void Print(PrnStream &stream, bool bSummary)
Write the blocks of the heap in address order.
void Compact(int nByteBudget, bool bStrict)
Move the handle blocks after the first free block that has some down over it, within a budget,...
void * Realloc(void *pData, int nSizeWords, int *pnSizeWords)
Shrink a block of the heap in place, returning its spare words.
void InsertFreeBlock(FreeBlock *pBlock, int nSizeWords, FreeBlock *pPrev, FreeBlock *pNext)
Make a free block of a region and link it between two free blocks.
int GetSizeWords() const
Definition heap.h:176
void GetInfo(int *pnBlocks, int *pnFreeBytes, int *pnBiggest)
Report the free blocks.
const char * Name() const
Report the name of the heap.
const char * GetName() const
Definition heap.h:181
bool Free(void *pData)
Return a block to the free list, merging it with its free neighbours.
void Init(const char *pszName, int nNum, int *pStart, int nSizeWords, int bHandles)
Take over a region as one free block, starting at the first word whose next word is 16-byte aligned.
void * Alloc(int nSizeWords, const char *pszTag, int nAlignShift, int *pnSizeWords)
Hand out a block from the smallest free block that fits.
Text output stream.
Definition prnstream.h:16