FMallocBinned2

Optimized virtual memory allocator.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Core

Header

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

Include

#include "HAL/MallocBinned2.h"

Syntax

class FMallocBinned2 : public FMalloc

Remarks

Optimized virtual memory allocator.

Constructors

Name Description

Public function

FMallocBinned2()

Destructors

Name Description

Public function Virtual

~FMallocBinned2()

Functions

Name Description

Public function

uint32

 

BoundSizeToPoolIndex

(
    SIZE_T Size
)

Public function

void

 

FlushCurrentThreadCache()

Public function

void

 

FreeExternal

(
    void* Ptr
)

Public function

void

 

FreeInline

(
    void* Ptr
)

Public function

bool

 

GetAllocationSizeExternal

(
    void* Ptr,
    SIZE_T& SizeOut
)

Public function Const

int64

 

GetTotalAllocatedSmallPoolMemory()

Public function

void *

 

MallocExternalLarge

(
    SIZE_T Size,
    uint32 Alignment
)

Public function

void *

 

MallocExternalSmall

(
    SIZE_T Size,
    uint32 Alignment
)

Public function

void *

 

MallocInline

(
    SIZE_T Size,
    uint32 Alignment
)

Public function

void *

 

MallocSelect

(
    SIZE_T Size,
    uint32 Alignment
)

Public function

uint32

 

PoolIndexToBlockSize

(
    uint32 PoolIndex
)

Public function

void *

 

ReallocExternal

(
    void* Ptr,
    SIZE_T NewSize,
    uint32 Alignment
)

Public function

void *

 

ReallocInline

(
    void* Ptr,
    SIZE_T NewSize,
    uint32 Alignment
)

Public function Static

bool

 

UseSmallAlloc

(
    SIZE_T Size,
    uint32 Alignment
)

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 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

FPoolInfo

Public struct

PoolHashBucket

Hash table struct for retrieving allocation book keeping information

Public struct

Private

Constants

Name

Description

Binned2TlsSlot

MallocBinned2

MemSizeToIndex

Mapping of sizes to small table indices.

OsAllocationGranularity

PageSize

SmallBlockSizesReversed