FMallocCallstackHandler

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/HAL/MallocCallstackHandler.h

Include

#include "HAL/MallocCallstackHandler.h"

Syntax

class FMallocCallstackHandler : public FMalloc

Variables

Name Description

Protected variable

TArray< FCallSt...

 

CallStackInfoArray

Protected variable

TMap< FCallStac...

 

CallStackMapKeyToCallStackIndexMap

Protected variable

FCriticalSectio...

 

CriticalSection

Protected variable

uint32

 

DisabledTLS

Protected variable

bool

 

Initialized

Protected variable

FRWLock

 

RWLock

Protected variable

FMalloc *

 

UsedMalloc

Malloc we're based on, aka using under the hood

Constructors

Name Description

Public function

FMallocCallstackHandler

(
    FMalloc* InMalloc
)

Functions

Name Description

Protected function

void

 

DecDisabled()

Public function

void

 

DumpStackTraceToLog

(
    int32 StackIndex
)

Protected function Virtual

int32

 

GetCallStackIndex()

Protected function

void

 

IncDisabled()

Public function Virtual

void

 

Init()

Protected function Virtual

bool

 

IsDisabled()

Protected function

void

 

TrackFree

(
    void* Ptr,
    uint32 OldSize,
    int32 CallStackIndex
)

Protected function

void

 

TrackMalloc

(
    void* Ptr,
    uint32 Size,
    int32 CallStackIndex
)

Protected function

void

 

TrackRealloc

(
    void* OldPtr,
    void* NewPtr,
    uint32 NewSize,
    uint32 OldSize,
    int32 CallStackIndex
)

Overridden from FMalloc

Name Description

Public function Virtual

void

 

ClearAndDisableTLSCachesOnCurrentThread()

Clears the TLS caches on the current thread and disables any future caching.

Public function Virtual

void

 

DumpAllocatorStats

(
    FOutputDevice& Ar
)

Dumps current allocator stats to the log.

Public function Virtual

void

 

Free

(
    void* Original
)

Free

Public function Virtual

bool

 

GetAllocationSize

(
    void* Original,
    SIZE_T& SizeOut
)

If possible determine the size of the memory allocated at the given address

Public function Virtual

void

 

GetAllocatorStats

(
    FGenericMemoryStats& out_Stats
)

Writes allocator stats from the last update into the specified destination.

Public function Virtual

const TCHAR ...

 

GetDescriptiveName()

Gets descriptive name for logging purposes.

Public function Virtual

void

 

InitializeStatsMetadata()

Initializes stats metadata.

Public function Virtual Const

bool

 

IsInternallyThreadSafe()

Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it.

Public function Virtual

void *

 

Malloc

(
    SIZE_T Count,
    uint32 Alignment
)

Malloc

Public function Virtual

SIZE_T

 

QuantizeSize

(
    SIZE_T Count,
    uint32 Alignment
)

For some allocators this will return the actual size that should be requested to eliminate internal fragmentation.

Public function Virtual

void *

 

Realloc

(
    void* Original,
    SIZE_T Count,
    uint32 Alignment
)

Realloc

Public function Virtual

void

 

SetupTLSCachesOnCurrentThread()

Set up TLS caches on the current thread. These are the threads that we can trim.

Public function Virtual

void

 

Trim

(
    bool bTrimThreadCaches
)

Releases as much memory as possible. Must be called from the main thread.

Public function Virtual

void

 

UpdateStats()

Called once per frame, gathers and sets all memory allocator statistics into the corresponding stats.

Public function Virtual

bool

 

ValidateHeap()

Validates the allocator's heap

Classes

Name

Description

Public struct

FCallStackInfo

Public struct

FCallStackMapKey

Used as a key in our current allocations/freed allocations maps

Constants

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