FGenericPlatformMemory

Generic implementation for most platforms, these tend to be unused and unimplemented.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMemory.h

Include

#include "GenericPlatform/GenericPlatformMemory.h"

Syntax

struct FGenericPlatformMemory

Remarks

Generic implementation for most platforms, these tend to be unused and unimplemented.

Functions

Name Description

Public function

struct

 

attribute

(
    (packed)
)

Assume it is either clang or something that supports the clang attributes

Public function Static

FMalloc *...

 

BaseAllocator()

Public function Static

void *

 

BigBlockMemcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Memcpy optimized for big blocks.

Public function Static

void *

 

BinnedAllocFromOS

(
    SIZE_T Size
)

Allocates pages from the OS.

Public function Static

void

 

BinnedFreeToOS

(
    void* Ptr,
    SIZE_T Size
)

Returns pages allocated by BinnedAllocFromOS to the OS.

Public function Static

bool

 

BinnedPlatformHasMemoryPoolForThisSize

(
    SIZE_T Size
)

Some platforms may pool allocations of this size to reduce OS calls.

Public function Static

void

 

DumpPlatformAndAllocatorStats

(
    FOutputDevice& Ar
)

Dumps basic platform memory statistics and allocator specific statistics into the specified output device.

Public function Static

void

 

DumpStats

(
    FOutputDevice& Ar
)

Dumps basic platform memory statistics into the specified output device.

Public function Static

uint32

 

GetBackMemoryPoolSize()

Public function Static

const FPlatf...

 

GetConstants()

Public function Static

uint64

 

GetExtraDevelopmentMemorySize()

Returns >0 if debug memory has been assigned to the title for general use.

Public function Static

bool

 

GetLLMAllocFunctions

(
    void*(*&)(size_t) OutAlloc...,
    void*, size_t) Ou...,
    int32& OutAlignment
)

This function sets AllocFunction and FreeFunction and returns true, or just returns false.

Public function Static

EPlatformMem...

 

GetMemorySizeBucket()

Return which "high level", per platform, memory bucket we are in

Public function Static

uint64

 

GetMemoryUsedFast()

Public function Static

uint32

 

GetPhysicalGBRam()

Public function Static

FPlatformMem...

 

GetStats()

Public function Static

void

 

GetStatsForMallocProfiler

(
    FGenericMemoryStats& out_Stats
)

Writes all platform specific current memory statistics in the format usable by the malloc profiler.

Public function Static

bool

 

HasForkPageProtectorEnabled()

Returns true if Protecting the parent processes pages has been enabled Only supported on platforms that support forking

Public function Static

void

 

Init()

Initializes platform memory specific constants.

Protected function Static

void

 

InternalUpdateStats

(
    const FPlatformMemoryStats& Memory...
)

Updates platform specific stats.

Public function Static

bool

 

IsExtraDevelopmentMemoryAvailable()

Returns true if debug memory has been assigned to the title for general use.

Public function Static

bool

 

IsNanoMallocAvailable()

Nano Malloc is Apple's tiny block allocator. Does the Nano malloc zone exist?

Public function Static

FSharedMemor...

 

MapNamedSharedMemoryRegion

(
    const FString& Name,
    bool bCreate,
    uint32 AccessMode,
    SIZE_T Size
)

Maps a named shared memory region into process address space (creates or opens it)

Public function Static

int32

 

Memcmp

(
    const void* Buf1,
    const void* Buf2,
    SIZE_T Count
)

Public function Static

void *

 

Memcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Public function Static

void *

 

Memmove

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Copies count bytes of characters from Src to Dest.

Public function Static

void *

 

Memset

(
    void* Dest,
    uint8 Char,
    SIZE_T Count
)

Public function Static

void

 

Memswap

(
    void* Ptr1,
    void* Ptr2,
    SIZE_T Size
)

Public function Static

void *

 

Memzero

(
    void* Dest,
    SIZE_T Count
)

Public function Static

void

 

NanoMallocInit()

Performs initial setup for Nano malloc. This is a noop on non-apple platforms

Public function Static

void

 

OnLowLevelMemory_Alloc

(
    void const* Pointer,
    uint64 Size,
    uint64 Tag
)

Called for all default tracker LLM allocations and frees, when LLM is enabled.

Public function Static

void

 

OnLowLevelMemory_Free

(
    void const* Pointer,
    uint64 Size,
    uint64 Tag
)

Public function Static

void

 

OnOutOfMemory

(
    uint64 Size,
    uint32 Alignment
)

Public function Static

bool

 

PageProtect

(
    void*const Ptr,
    const SIZE_T Size,
    const bool bCanRead,
    const bool bCanWrite
)

Changes the protection on a region of committed pages in the virtual address space.

Public function Static

bool

 

PtrIsFromNanoMalloc

(
    void* Ptr
)

Was this pointer allocated by in the Nano Malloc Zone? Currently only Apple platforms implement this to detect small block allocations.

Public function Static

bool

 

PtrIsOSMalloc

(
    void* Ptr
)

Was this pointer allocated by the OS malloc? Currently only Apple platforms implement this to detect small block allocations.

Public function Static

T

 

ReadUnaligned

(
    const void* Ptr
)

Loads a simple POD type from unaligned memory.

Public function Static

void

 

RegisterCustomLLMTags()

Called once at LLM initialization time to let the platform add any custom tags

Public function Static

void

 

SetupMemoryPools()

Initializes the memory pools, should be called by the init function.

Public function Static

void *

 

StreamingMemcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

On some platforms memcpy optimized for big blocks that avoid L2 cache pollution are available

Public function Static

bool

 

SupportsFastVRAMMemory()

Gets whether this platform supports Fast VRAM memory Ie, whether TexCreate_FastVRAM flags actually mean something or not

Public function Static

bool

 

UnmapNamedSharedMemoryRegion

(
    FSharedMemoryRegion* MemoryReg...
)

Unmaps a name shared memory region

Public function Static

void

 

UpdateCustomLLMTags()

Called once per frame when LLM is collating the data for the current frame.

Public function Static

void

 

WriteUnaligned

(
    void* Ptr,
    const T& InValue
)

Stores a simple POD type to unaligned memory.

Classes

Name

Description

Public class

FBasicVirtualMemoryBlock

Public struct

FSharedMemoryRegion

Generic representation of a shared memory region

Enums

Name

Description

Public enum

EMemoryAllocatorToUse

Which allocator is being used

Public enum

EMemoryCounterRegion

Various memory regions that can be used with memory stats.

Public enum

ESharedMemoryAccess

Flags used for shared memory creation/open

Constants

Name

Description

AllocatorToUse

Current allocator

BackupOOMMemoryPool

Preallocated buffer to delete on out of memory. Used by OOM handling and crash reporting.

BackupOOMMemoryPoolSize

Size of BackupOOMMemoryPool in bytes.

bIsOOM

Set to true if we encounters out of memory.

OOMAllocationAlignment

Set to alignment of allocation that triggered out of memory, zero otherwise.

OOMAllocationSize

Set to size of allocation that triggered out of memory, zero otherwise.

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