FMallocLeakReporter

[FMallocLeakReporter](API\Runtime\Engine\ProfilingDebugging\FMallocLeakReporter) is a helper class that works alongside FMallocLeakDetection to provide easy access to reports of low-level memory leaks.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/ProfilingDebugging/MallocLeakReporter.h

Include

#include "ProfilingDebugging/MallocLeakReporter.h"

Syntax

class FMallocLeakReporter

Remarks

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 implemnent this funtionality 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 > 0KB 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

Variables

Name Description

Protected variable

FDelegateHandle

 

CheckpointTicker

Protected variable

FMallocLeakRepo...

 

DefaultAllocReportOptions

Protected variable

FMallocLeakRepo...

 

DefaultLeakReportOptions

Report vars.

Protected variable

bool

 

Enabled

Protected variable

int32

 

ReportCount

Protected variable

FMallocLeakRepo...

 

ReportDelegate

Protected variable

FDelegateHandle

 

ReportTicker

Constructors

Name Description

Protected function

FMallocLeakReporter()

Private constructor

Functions

Name Description

Protected function

void

 

Checkpoint()

Called internally to generate rate checkpoints

Public function

void

 

Clear()

Clears all accumulated data

Public function Static

FMallocLeakR...

 

Get()

Return singleton instance

Public function Const

bool

 

IsEnabled()

Returns our enabled state

Public function

void

 

SetDefaultAllocReportOptions

(
    const FMallocLeakReportOptions& Op...
)

Sets default options for reporting allocations

Public function

void

 

SetDefaultLeakReportOptions

(
    const FMallocLeakReportOptions& Op...
)

Sets default options for what are considered memory leaks

Public function

void

 

Start

(
    int32 FilterSize,
    float ReportOnTime
)

Starts tracking allocations.

Public function

void

 

Stop()

Stop tracking leaks

Public function

int32

 

WriteReport

(
    const TCHAR* ReportName,
    const FMallocLeakReportOptions& Op...
)

Writes out a report according to the passed in options

Public function

int32

 

WriteReports

(
    const uint32 ReportFlags
)

Writes out a set of reports according to our defaults

Classes

Name

Description

Public struct

EReportOption

Typedefs

Name

Description

FMallocLeakReportDelegate

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss