wavelength 1.0.0
Loading...
Searching...
No Matches
MemMgr.h
Go to the documentation of this file.
1#pragma once
2
3#include "utl/Heap.h"
4#include "utl/PrnStream.h"
5
7const int MAX_HEAPS = 16;
8
14extern Heap gHeaps[MAX_HEAPS];
15
21extern int gNumHeaps;
22
28extern bool gMemTracking;
29
35extern bool gTrackStl;
36
44
54void MemFreeBlockStats(int heapNum, int *numBlocks, int *freeBytes, int *biggestBlock);
55
63void MemGetSystemMemory(int **begin, int **end);
64
75int MemAddHeap(const char *name, int *start, int sizeWords, bool flag);
76
84void MemResizeHeap(int heapNum, int sizeWords);
85
92void MemPushHeap(int iHeap);
93
100
109
117void MemInit();
118
128void *MemAlloc(int size, const char *name, int align);
129
136void MemFree(void *mem);
137
145int MemFindHeap(const char *name);
146
154void MemPrintHeap(int heapNum, PrnStream &stream);
void MemPreInit()
Set up the main heap over all system memory.
bool gMemTracking
Whether allocations are reported to the memory tracker.
void MemFree(void *mem)
Free an allocation of any heap.
void MemGetSystemMemory(int **begin, int **end)
Take the memory the heaps are carved from from the C runtime.
void MemPrintHeap(int heapNum, PrnStream &stream)
Print every allocation of a heap.
void * MemAlloc(int size, const char *name, int align)
Allocate from the current heap.
void MemPushHeap(int iHeap)
Make a heap the source of new allocations until MemPopHeap().
int MemCurrentHeap()
Report the heap new allocations come from.
int MemAddHeap(const char *name, int *start, int sizeWords, bool flag)
Add a heap.
const int MAX_HEAPS
Number of heaps the memory manager can hold.
Definition MemMgr.h:7
void MemPopHeap()
Return to the heap in use before the last MemPushHeap().
void MemFreeBlockStats(int heapNum, int *numBlocks, int *freeBytes, int *biggestBlock)
Report the free runs of a heap.
void MemResizeHeap(int heapNum, int sizeWords)
Move the end of a heap.
int gNumHeaps
Number of heaps in use.
bool gTrackStl
Whether STL allocations are named after their element type for the memory tracker.
Heap gHeaps[MAX_HEAPS]
The heaps.
int MemFindHeap(const char *name)
Find a heap by name.
void MemInit()
Split system memory into the heaps of the heaps_pc configuration and set up the pools.
Region of memory that hands out word-aligned blocks from a free list, best fit first.
Definition heap.h:38
Text output stream.
Definition prnstream.h:16
int start(int argc, char **argv)
The Conexant USB modem driver registers with usbd and drives each matching modem for the modem librar...