UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FMallocLeakReporter Class Reference

#include <MallocLeakReporter.h>

Classes

struct  EReportOption
 

Public Member Functions

ENGINE_API void Start (int32 FilterSize=0, float ReportOnTime=0.0f)
 
ENGINE_API void Stop ()
 
ENGINE_API void Clear ()
 
bool IsEnabled () const
 
ENGINE_API int32 WriteReports (const uint32 ReportFlags=EReportOption::ReportAll)
 
ENGINE_API int32 WriteReport (const TCHAR *ReportName, const FMallocLeakReportOptions &Options)
 
void SetDefaultLeakReportOptions (const FMallocLeakReportOptions &Options)
 
void SetDefaultAllocReportOptions (const FMallocLeakReportOptions &Options)
 

Static Public Member Functions

static ENGINE_API FMallocLeakReporterGet ()
 

Protected Member Functions

ENGINE_API FMallocLeakReporter ()
 
ENGINE_API void Checkpoint ()
 

Protected Attributes

bool Enabled
 
int32 ReportCount
 
FTSTicker::FDelegateHandle CheckpointTicker
 
FTSTicker::FDelegateHandle ReportTicker
 
FMallocLeakReportDelegate ReportDelegate
 
FMallocLeakReportOptions DefaultLeakReportOptions
 
FMallocLeakReportOptions DefaultAllocReportOptions
 

Detailed Description

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

Constructor & Destructor Documentation

◆ FMallocLeakReporter()

FMallocLeakReporter::FMallocLeakReporter ( )
protected

Private constructor

Member Function Documentation

◆ Checkpoint()

void FMallocLeakReporter::Checkpoint ( )
protected

Called internally to generate rate checkpoints

◆ Clear()

void FMallocLeakReporter::Clear ( )

Clears all accumulated data

◆ Get()

FMallocLeakReporter & FMallocLeakReporter::Get ( )
static

Return singleton instance

◆ IsEnabled()

bool FMallocLeakReporter::IsEnabled ( ) const
inline

Returns our enabled state

Returns
: bool

◆ SetDefaultAllocReportOptions()

void FMallocLeakReporter::SetDefaultAllocReportOptions ( const FMallocLeakReportOptions Options)
inline

Sets default options for reporting allocations

Parameters
Options
Returns
: void

◆ SetDefaultLeakReportOptions()

void FMallocLeakReporter::SetDefaultLeakReportOptions ( const FMallocLeakReportOptions Options)
inline

Sets default options for what are considered memory leaks

Parameters
Options
Returns
: void

◆ Start()

void FMallocLeakReporter::Start ( int32  FilterSize = 0,
float  ReportOnTime = 0.0f 
)

Starts tracking allocations.

Parameters
FilterSize Only track allocations >= this value in bytes. Higher values affect performance less
ReportOnTime Write out a report every N seconds
Returns
: void

◆ Stop()

void FMallocLeakReporter::Stop ( )

Stop tracking leaks

◆ WriteReport()

int32 FMallocLeakReporter::WriteReport ( const TCHAR ReportName,
const FMallocLeakReportOptions Options 
)

Writes out a report according to the passed in options

◆ WriteReports()

int32 FMallocLeakReporter::WriteReports ( const uint32  ReportFlags = EReportOption::ReportAll)

Writes out a set of reports according to our defaults

Member Data Documentation

◆ CheckpointTicker

FTSTicker::FDelegateHandle FMallocLeakReporter::CheckpointTicker
protected

◆ DefaultAllocReportOptions

FMallocLeakReportOptions FMallocLeakReporter::DefaultAllocReportOptions
protected

◆ DefaultLeakReportOptions

FMallocLeakReportOptions FMallocLeakReporter::DefaultLeakReportOptions
protected

◆ Enabled

bool FMallocLeakReporter::Enabled
protected

◆ ReportCount

int32 FMallocLeakReporter::ReportCount
protected

◆ ReportDelegate

FMallocLeakReportDelegate FMallocLeakReporter::ReportDelegate
protected

◆ ReportTicker

FTSTicker::FDelegateHandle FMallocLeakReporter::ReportTicker
protected

The documentation for this class was generated from the following files: