112 static Heap *
Create(
void *pBlock,
unsigned nSize,
unsigned nFlags);
128 void *
Alloc(
unsigned nSize,
const char *pszFile,
int nLine);
142 void Free(
void *pBlock,
const char *pszFile,
int nLine);
160 void *
Realloc(
void *pBlock,
unsigned nSize,
const char *pszFile,
int nLine);
184 void UnlinkFreeNode(
HeapNode *pNode);
Boundary-tagged heap over one contiguous block.
Definition heap.h:93
int Shrink(unsigned nSize)
Shorten the whole heap.
static Heap * Create(void *pBlock, unsigned nSize, unsigned nFlags)
Build a heap over a block.
void * Alloc(unsigned nSize, const char *pszFile, int nLine)
Take a block.
friend void HHeapDelete(Heap *pHeap)
Release a heap's backing block.
friend void HHeapLogBasicStats(Heap *pHeap)
Write a heap's counters to the log and to the memory report.
friend void HHeapDump(Heap *pHeap, const char *pszPath)
Write a heap's header, counters, timings, and every node to a file.
void Free(void *pBlock, const char *pszFile, int nLine)
Give a block back.
void * Realloc(void *pBlock, unsigned nSize, const char *pszFile, int nLine)
Resize a block.
constexpr unsigned kHeapFlagBestFit
Take the smallest free node that fits.
Definition heap.h:37
Heap * gpPythonHeap
The one interpreter heap, built by Py_Initialize() over the whole of the zone called python.
void HHeapDelete(Heap *pHeap)
Release a heap's backing block.
constexpr unsigned kHeapFlagFirstFit
Take the first free node that fits rather than the smallest.
Definition heap.h:34
void HHeapLogBasicStats(Heap *pHeap)
Write a heap's counters to the log and to the memory report.
void HHeapDump(Heap *pHeap, const char *pszPath)
Write a heap's header, counters, timings, and every node to a file.
constexpr int kHeapPayloadAlignment
Every payload size is rounded up to a multiple of this.
Definition heap.h:23
constexpr unsigned kHeapFlagFatalWhenFull
Treat exhaustion as fatal rather than reporting a null block.
Definition heap.h:40
constexpr int kHeapHeaderSize
The number of bytes the header occupies at the front of the block.
Definition heap.h:11
constexpr unsigned kHeapFlagOwnsBlock
The heap allocated its own backing block and releases it when destroyed.
Definition heap.h:43
constexpr int kHeapMinPayloadSize
The smallest payload a node may serve.
Definition heap.h:20
constexpr int kHeapFreeNodeSize
The number of bytes a free node occupies, which is all four of its words.
Definition heap.h:17
constexpr int kHeapSplitThreshold
A remainder smaller than this is not worth splitting off.
Definition heap.h:31
constexpr int kHeapNodePrologueSize
The number of bytes of a node that precede its payload.
Definition heap.h:14
One node of a heap, which is the boundary tag in front of a block.
Definition heap.h:56
HeapNode * mNext
Definition heap.h:58
uintptr_t mPrevAndFree
Definition heap.h:57
HeapNode * mFreePrev
Definition heap.h:59
HeapNode * mFreeNext
Definition heap.h:60