Navigation
API > API/Runtime > API/Runtime/Engine
FMallocLeakReporter is a helper class that works alongside FMallocLeakDetection to provide easy access to reports of low-level memory leaks.
The reporter can be operated from the console where it can be started/stopped and used to periodically or manually report leaks, or it can be called from game code to implement this functionality at desired times.
Example Console Usage:
"mallocleak.start report=300" - start tracking leaks and generate a report every 300 secs "mallocleak report" - report allocations and leaks "mallocleak stop" - stop tracking leaks
Example Code usage
FMallocLeakReporter::Get().Start(0, 300) - start tracking allocs > 0 bytes and generate a report every 300 secs FMallocLeakReporter::Get().WriteReports() - Writes reports and returns the number of suspected leaks FMallocLeakReporter::Get().WriteReport(TEXT("BigAllocs"), Options); - Write custom report of allocations that matches "Options" FMallocLeakReporter::Get().Stop() - stop tracking allocations
Reports are written to the profiling dir, e,g GameName/Saved/Profiling/SessionName
| Name | FMallocLeakReporter |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Public/ProfilingDebugging/MallocLeakReporter.h |
| Include Path | #include "ProfilingDebugging/MallocLeakReporter.h" |
Syntax
class FMallocLeakReporter
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FMallocLeakReporter() |
Private constructor | ProfilingDebugging/MallocLeakReporter.h |
Structs
| Name | Remarks |
|---|---|
| EReportOption |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FMallocLeakReportDelegate | TMulticastDelegate_TwoParams< void, const int32, const int32 > | ProfilingDebugging/MallocLeakReporter.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Clear() |
Clears all accumulated data | ProfilingDebugging/MallocLeakReporter.h | |
bool IsEnabled() |
Returns our enabled state | ProfilingDebugging/MallocLeakReporter.h | |
void SetDefaultAllocReportOptions
(
const FMallocLeakReportOptions& Options |
Sets default options for reporting allocations | ProfilingDebugging/MallocLeakReporter.h | |
void SetDefaultLeakReportOptions
(
const FMallocLeakReportOptions& Options |
Sets default options for what are considered memory leaks | ProfilingDebugging/MallocLeakReporter.h | |
void Start
(
int32 FilterSize, |
Starts tracking allocations. | ProfilingDebugging/MallocLeakReporter.h | |
void Stop() |
Stop tracking leaks | ProfilingDebugging/MallocLeakReporter.h | |
int32 WriteReport
(
const TCHAR* ReportName, |
Writes out a report according to the passed in options | ProfilingDebugging/MallocLeakReporter.h | |
int32 WriteReports
(
const uint32 ReportFlags |
Writes out a set of reports according to our defaults | ProfilingDebugging/MallocLeakReporter.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Checkpoint() |
Called internally to generate rate checkpoints | ProfilingDebugging/MallocLeakReporter.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FMallocLeakReporter & Get() |
Return singleton instance | ProfilingDebugging/MallocLeakReporter.h |