Allocation tracker for one heap.
More...
#include <MemTrack.h>
|
| | MemTrack (int heap, int *begin, int *end) |
| | Start tracking a heap.
|
| void | SetHeapRange (int *heapBegin, int *heapEnd) |
| | Follow a heap that grew or shrank.
|
| void | CreateStatTables () |
| | Create the statistics tables.
|
| void | Alloc (int size, const char *type, int actual, void *ptr) |
| | Record a heap allocation.
|
| void | PoolAlloc (int size, const char *type, void *ptr) |
| | Record a pool node.
|
| void | Free (void *ptr, bool pooled) |
| | Forget an allocation or a pool node.
|
| int | BytesFree () const |
| | Report the bytes of the heap not allocated.
|
| void | ReportAllocsByName (PrnStream &stream) |
| | Print how many allocations share each name and size.
|
| void | Report (PrnStream &stream, int minSize) |
| | Print the heap's totals and its allocations by name.
|
| void | DiffReport (PrnStream &stream) |
| | Print the change of every total since the previous report, then swap the tables.
|
| bool | InitOK () const |
| | Report whether the mirror array was allocated.
|
Allocation tracker for one heap.
A mirror array holds an AllocInfo pointer for every word of the heap where an allocation starts. Two pairs of BlockStatTable alternate between reports. Each report prints the change since the previous one. The object is 0xe4 bytes. The name comes from the source file.
◆ MemTrack()
| MemTrack::MemTrack |
( |
int | heap, |
|
|
int * | begin, |
|
|
int * | end ) |
Start tracking a heap.
- Parameters
-
| heap | The heap's index. |
| begin | The heap's first word. |
| end | The word past the heap. |
- Ghidra address:
- 0x100177f0
◆ SetHeapRange()
| void MemTrack::SetHeapRange |
( |
int * | heapBegin, |
|
|
int * | heapEnd ) |
Follow a heap that grew or shrank.
The start must not move.
- Parameters
-
| heapBegin | The heap's first word. |
| heapEnd | The word past the heap. |
- Ghidra address:
- 0x10017880
◆ CreateStatTables()
| void MemTrack::CreateStatTables |
( |
| ) |
|
Create the statistics tables.
- Ghidra address:
- 0x10017920
◆ Alloc()
| void MemTrack::Alloc |
( |
int | size, |
|
|
const char * | type, |
|
|
int | actual, |
|
|
void * | ptr ) |
Record a heap allocation.
- Parameters
-
| size | The bytes requested. |
| type | The allocation's name. |
| actual | The bytes allocated. |
| ptr | The allocation. |
- Ghidra address:
- 0x100179c0
◆ PoolAlloc()
| void MemTrack::PoolAlloc |
( |
int | size, |
|
|
const char * | type, |
|
|
void * | ptr ) |
Record a pool node.
- Parameters
-
| size | The node size in bytes. |
| type | The node's name. |
| ptr | The node. |
- Ghidra address:
- 0x10017b00
◆ Free()
| void MemTrack::Free |
( |
void * | ptr, |
|
|
bool | pooled ) |
Forget an allocation or a pool node.
- Parameters
-
| ptr | The allocation or node. |
| pooled | Whether a pool node is freed. |
- Ghidra address:
- 0x10017bd0
◆ BytesFree()
| int MemTrack::BytesFree |
( |
| ) |
const |
Report the bytes of the heap not allocated.
- Returns
- The free bytes.
- Ghidra address:
- 0x10017d20
◆ ReportAllocsByName()
| void MemTrack::ReportAllocsByName |
( |
PrnStream & | stream | ) |
|
Print how many allocations share each name and size.
- Parameters
-
- Ghidra address:
- 0x10017d30
◆ Report()
| void MemTrack::Report |
( |
PrnStream & | stream, |
|
|
int | minSize ) |
Print the heap's totals and its allocations by name.
- Parameters
-
| stream | The destination. |
| minSize | The smallest total, in bytes allocated, that prints. |
- Ghidra address:
- 0x10017fe0
◆ DiffReport()
| void MemTrack::DiffReport |
( |
PrnStream & | stream | ) |
|
Print the change of every total since the previous report, then swap the tables.
- Parameters
-
- Ghidra address:
- 0x100182e0
◆ InitOK()
| bool MemTrack::InitOK |
( |
| ) |
const |
|
inline |
Report whether the mirror array was allocated.
- Returns
- Whether tracking works.
The documentation for this class was generated from the following file: