Tracker of the allocations of one heap, with one AllocInfo slot for each word of the heap.
More...
#include <heaptracker.h>
|
| | HeapTracker (int nHeap, int *pStart, int *pEnd) |
| | Track a heap, with a cleared slot for each word.
|
| void | SetRange (int *pStart, int *pEnd) |
| | Move the end of the heap after the heap was resized.
|
| void | CreateTables () |
| | Create the two pairs of statistics tables the reports fill.
|
| void | Alloc (int nRequested, const char *pszTag, int nActual, void *pData) |
| | Record an allocation.
|
| void | Realloc (void *pOld, int nRequested, int nActual, void *pNew) |
| | Move the record of an allocation that changed size or address.
|
| void | PoolAlloc (int nSize, const char *pszTag, void *pData) |
| | Mark the record at an address as a pool block, creating the record when there is none.
|
| void | Free (void *pData, bool bPool) |
| | Remove the record of an allocation, or only its pool block marks.
|
| void | Poll () |
| | Store the counts of the frame in the history and start new ones.
|
| int | FreeBytes () |
| | Report the bytes of the heap not handed out.
|
| void | ReportByRecord (PrnStream &stream) |
| | Write the number of allocations with each distinct record, using the heap "debug" for the report's own memory when it exists.
|
| void | Report (PrnStream &stream, int nMinSize) |
| | Write the totals of the heap and the totals of each tag.
|
| void | ReportDiff (PrnStream &stream) |
| | Write the changes of each tag since the previous report, and switch tables.
|
|
| static void * | operator new (size_t nSize) |
| | Take a tracker from the memory tracker's own region.
|
| static void | operator delete (void *) noexcept |
| | Ignore the release of a tracker.
|
Tracker of the allocations of one heap, with one AllocInfo slot for each word of the heap.
The class is not polymorphic. The name is inferred. MemTrackAddHeap() creates one for each heap while memory tracking is available.
◆ HeapTracker()
| HeapTracker::HeapTracker |
( |
int | nHeap, |
|
|
int * | pStart, |
|
|
int * | pEnd ) |
Track a heap, with a cleared slot for each word.
- Parameters
-
| nHeap | The index of the heap. |
| pStart | The first word of the heap. |
| pEnd | The end of the heap. |
- Ghidra address:
- NTSC-U/C: 0x0029b240
- Ghidra address:
- PAL: 0x002a4e60
◆ operator new()
| void * HeapTracker::operator new |
( |
size_t | nSize | ) |
|
|
static |
Take a tracker from the memory tracker's own region.
- Parameters
-
| nSize | The size of the tracker. |
- Returns
- The tracker.
◆ operator delete()
| void HeapTracker::operator delete |
( |
void * | | ) |
|
|
inlinestaticnoexcept |
Ignore the release of a tracker.
The memory tracker's region never takes memory back.
◆ SetRange()
| void HeapTracker::SetRange |
( |
int * | pStart, |
|
|
int * | pEnd ) |
Move the end of the heap after the heap was resized.
mStart stays as it was.
- Parameters
-
| pStart | The first word of the heap. |
| pEnd | The end of the heap. |
- Ghidra address:
- NTSC-U/C: 0x0029b2e8
- Ghidra address:
- PAL: 0x002a4f08
◆ CreateTables()
| void HeapTracker::CreateTables |
( |
| ) |
|
Create the two pairs of statistics tables the reports fill.
- Ghidra address:
- NTSC-U/C: 0x0029b300
- Ghidra address:
- PAL: 0x002a4f20
◆ Alloc()
| void HeapTracker::Alloc |
( |
int | nRequested, |
|
|
const char * | pszTag, |
|
|
int | nActual, |
|
|
void * | pData ) |
Record an allocation.
- Parameters
-
| nRequested | The bytes requested. |
| pszTag | The allocation tag. |
| nActual | The bytes handed out. |
| pData | The allocation. |
- Ghidra address:
- NTSC-U/C: 0x0029b368
- Ghidra address:
- PAL: 0x002a4f88
◆ Realloc()
| void HeapTracker::Realloc |
( |
void * | pOld, |
|
|
int | nRequested, |
|
|
int | nActual, |
|
|
void * | pNew ) |
Move the record of an allocation that changed size or address.
- Parameters
-
| pOld | The allocation before the change. |
| nRequested | The bytes requested, or -1 to retain them. |
| nActual | The bytes handed out, or -1 to retain them. |
| pNew | The allocation after the change. |
- Ghidra address:
- NTSC-U/C: 0x0029b460
- Ghidra address:
- PAL: 0x002a5080
◆ PoolAlloc()
| void HeapTracker::PoolAlloc |
( |
int | nSize, |
|
|
const char * | pszTag, |
|
|
void * | pData ) |
Mark the record at an address as a pool block, creating the record when there is none.
- Parameters
-
| nSize | The size of the pool block. |
| pszTag | The tag of the pool block. |
| pData | The pool block. |
- Ghidra address:
- NTSC-U/C: 0x0029b500
- Ghidra address:
- PAL: 0x002a5120
◆ Free()
| void HeapTracker::Free |
( |
void * | pData, |
|
|
bool | bPool ) |
Remove the record of an allocation, or only its pool block marks.
- Parameters
-
| pData | The allocation. |
| bPool | Whether a pool block is freed. Its record then goes only when it has no tag. |
- Ghidra address:
- NTSC-U/C: 0x0029b598
- Ghidra address:
- PAL: 0x002a51b8
◆ Poll()
| void HeapTracker::Poll |
( |
| ) |
|
Store the counts of the frame in the history and start new ones.
- Ghidra address:
- NTSC-U/C: 0x0029b640
- Ghidra address:
- PAL: 0x002a5260
◆ FreeBytes()
| int HeapTracker::FreeBytes |
( |
| ) |
|
Report the bytes of the heap not handed out.
- Returns
- The free bytes.
- Ghidra address:
- NTSC-U/C: 0x0029b698
- Ghidra address:
- PAL: 0x002a52b8
◆ ReportByRecord()
| void HeapTracker::ReportByRecord |
( |
PrnStream & | stream | ) |
|
Write the number of allocations with each distinct record, using the heap "debug" for the report's own memory when it exists.
- Parameters
-
| stream | The stream to write to. |
- Ghidra address:
- NTSC-U/C: 0x0029b6b8
- Ghidra address:
- PAL: 0x002a52d8
◆ Report()
| void HeapTracker::Report |
( |
PrnStream & | stream, |
|
|
int | nMinSize ) |
Write the totals of the heap and the totals of each tag.
- Parameters
-
| stream | The stream to write to. |
| nMinSize | The fewest bytes handed out for which a tag is listed. |
- Ghidra address:
- NTSC-U/C: 0x0029b950
- Ghidra address:
- PAL: 0x002a5570
◆ ReportDiff()
| void HeapTracker::ReportDiff |
( |
PrnStream & | stream | ) |
|
Write the changes of each tag since the previous report, and switch tables.
- Parameters
-
| stream | The stream to write to. |
- Ghidra address:
- NTSC-U/C: 0x0029bd30
- Ghidra address:
- PAL: 0x002a5950
◆ kHistorySize
| int HeapTracker::kHistorySize = 20 |
|
staticconstexpr |
The frames of allocation counts Poll() retains.
The documentation for this class was generated from the following file: