wavelength 1.0.0
Loading...
Searching...
No Matches
memtrack.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/blockpool.h"
4#include "os/heaptracker.h"
5#include "os/prnstream.h"
6#include "script/dataarray.h"
7
9constexpr int kMemTrackMaxHeaps = 16;
10
18
25
36
48void MemTrackAddHeap(int nHeap, int *pStart, int *pEnd);
49
60
73void MemTrackAlloc(int nRequested, const char *pszTag, int nActual, void *pData);
74
85void MemTrackFree(int nHeap, void *pData);
86
100void MemTrackRealloc(int nHeap, void *pOld, int nRequested, int nActual, void *pNew);
101
113void MemTrackPoolAlloc(int nSize, const char *pszTag, void *pData);
114
124void MemTrackPoolFree(void *pData);
125
136void *MemTrackBumpAlloc(int nBytes);
137
149void MemTrackReport(int nHeap, int nMinSize, PrnStream &stream);
150
161void MemTrackReportByRecord(int nHeap, PrnStream &stream);
Pool of equal blocks carved from a region, each free block linking to the next.
Definition blockpool.h:9
Tracker of the allocations of one heap, with one AllocInfo slot for each word of the heap.
Definition heaptracker.h:15
Text output stream.
Definition prnstream.h:16
void MemTrackFree(int nHeap, void *pData)
Remove the record of an allocation of a heap.
void MemTrackRealloc(int nHeap, void *pOld, int nRequested, int nActual, void *pNew)
Move the record of an allocation of a heap that changed size or address.
void MemTrackReportByRecord(int nHeap, PrnStream &stream)
Write the allocations of a heap counted by record.
void MemTrackPoolFree(void *pData)
Remove the marks of a block of the small-block pool.
constexpr int kMemTrackMaxHeaps
The heaps the memory tracker can follow.
Definition memtrack.h:9
void MemTrackPoolAlloc(int nSize, const char *pszTag, void *pData)
Mark a block of the small-block pool, which lies in heap 0.
void MemTrackReport(int nHeap, int nMinSize, PrnStream &stream)
Write the time, the report of a heap, and its changes since the previous report.
bool MemTrackInit()
Prepare the pool of AllocInfo records, when the development memory is present.
void MemTrackAlloc(int nRequested, const char *pszTag, int nActual, void *pData)
Record an allocation from the heap MemPushHeap() selected.
void MemTrackConfigure()
Register the script command heap_report, add the heap debug for the reports, and create the statistic...
void MemTrackAddHeap(int nHeap, int *pStart, int *pEnd)
Track a heap, or move the end of a heap already tracked.
void * MemTrackBumpAlloc(int nBytes)
Take 16-byte aligned memory from the development memory above 32 MB, which nothing returns.
HeapTracker * g_apMemTrackHeaps[kMemTrackMaxHeaps]
The tracker of each heap, or null.
BlockPool g_AllocInfoPool
The pool of the AllocInfo records of every tracker.