UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FWindowsPlatformMemory Struct Reference

#include <WindowsPlatformMemory.h>

+ Inheritance diagram for FWindowsPlatformMemory:

Classes

class  FPlatformVirtualMemoryBlock
 
struct  FWindowsSharedMemoryRegion
 

Public Types

enum  EMemoryCounterRegion {
  MCR_Invalid , MCR_Physical , MCR_GPU , MCR_GPUSystem ,
  MCR_TexturePool , MCR_StreamingPool , MCR_UsedStreamingPool , MCR_GPUDefragPool ,
  MCR_SamplePlatformSpecifcMemoryRegion , MCR_PhysicalLLM , MCR_MAX
}
 
- Public Types inherited from FGenericPlatformMemory
enum  EMemoryCounterRegion {
  MCR_Invalid , MCR_Physical , MCR_GPU , MCR_GPUSystem ,
  MCR_TexturePool , MCR_StreamingPool , MCR_UsedStreamingPool , MCR_GPUDefragPool ,
  MCR_PhysicalLLM , MCR_MAX
}
 
enum  EMemoryAllocatorToUse {
  Ansi , Stomp , TBB , Jemalloc ,
  Binned , Binned2 , Binned3 , Platform ,
  Mimalloc , Libpas
}
 
enum  ESharedMemoryAccess { Read = (1 << 1) , Write = (1 << 2) }
 

Static Public Member Functions

static CORE_API void Init ()
 
static uint32 GetBackMemoryPoolSize ()
 
static CORE_API class FMallocBaseAllocator ()
 
static CORE_API FPlatformMemoryStats GetStats ()
 
static CORE_API void GetStatsForMallocProfiler (FGenericMemoryStats &out_Stats)
 
static CORE_API const FPlatformMemoryConstantsGetConstants ()
 
static CORE_API bool PageProtect (void *const Ptr, const SIZE_T Size, const bool bCanRead, const bool bCanWrite)
 
static CORE_API voidBinnedAllocFromOS (SIZE_T Size)
 
static CORE_API void BinnedFreeToOS (void *Ptr, SIZE_T Size)
 
static CORE_API void MiMallocInit ()
 
static CORE_API FSharedMemoryRegionMapNamedSharedMemoryRegion (const FString &InName, bool bCreate, uint32 AccessMode, SIZE_T Size, const void *pSecurityAttributes=nullptr)
 
static CORE_API bool UnmapNamedSharedMemoryRegion (FSharedMemoryRegion *MemoryRegion)
 
static CORE_API bool GetLLMAllocFunctions (void *(*&OutAllocFunction)(size_t), void(*&OutFreeFunction)(void *, size_t), int32 &OutAlignment)
 
- Static Public Member Functions inherited from FGenericPlatformMemory
static CORE_API void Init ()
 
static CORE_API void OnOutOfMemory (uint64 Size, uint32 Alignment)
 
static CORE_API void SetupMemoryPools ()
 
static uint32 GetBackMemoryPoolSize ()
 
static CORE_API FMallocBaseAllocator ()
 
static CORE_API FPlatformMemoryStats GetStats ()
 
static CORE_API FPlatformMemoryStats GetStatsRaw ()
 
static CORE_API uint64 GetMemoryUsedFast ()
 
static CORE_API void GetStatsForMallocProfiler (FGenericMemoryStats &out_Stats)
 
static CORE_API const FPlatformMemoryConstantsGetConstants ()
 
static CORE_API uint32 GetPhysicalGBRam ()
 
static CORE_API bool PageProtect (void *const Ptr, const SIZE_T Size, const bool bCanRead, const bool bCanWrite)
 
static CORE_API voidBinnedAllocFromOS (SIZE_T Size)
 
static CORE_API void BinnedFreeToOS (void *Ptr, SIZE_T Size)
 
static void MiMallocInit ()
 
static void NanoMallocInit ()
 
static bool PtrIsOSMalloc (void *Ptr)
 
static bool IsNanoMallocAvailable ()
 
static bool PtrIsFromNanoMalloc (void *Ptr)
 
static bool BinnedPlatformHasMemoryPoolForThisSize (SIZE_T Size)
 
static CORE_API void DumpStats (FOutputDevice &Ar)
 
static CORE_API void DumpPlatformAndAllocatorStats (FOutputDevice &Ar)
 
static CORE_API EPlatformMemorySizeBucket GetMemorySizeBucket ()
 
static UE_FORCEINLINE_HINT voidMemmove (void *Dest, const void *Src, SIZE_T Count)
 
static UE_FORCEINLINE_HINT int32 Memcmp (const void *Buf1, const void *Buf2, SIZE_T Count)
 
static UE_FORCEINLINE_HINT voidMemset (void *Dest, uint8 Char, SIZE_T Count)
 
static UE_FORCEINLINE_HINT voidMemzero (void *Dest, SIZE_T Count)
 
static UE_FORCEINLINE_HINT voidMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
static UE_FORCEINLINE_HINT voidBigBlockMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
static UE_FORCEINLINE_HINT voidStreamingMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
static voidParallelMemcpy (void *Dest, const void *Src, SIZE_T Count, EMemcpyCachePolicy Policy=EMemcpyCachePolicy::StoreCached)
 
static void Memswap (void *Ptr1, void *Ptr2, SIZE_T Size)
 
template<typename T >
staticReadUnaligned (const void *Ptr)
 
template<typename T >
static UE_FORCEINLINE_HINT void WriteUnaligned (void *Ptr, const T &InValue)
 
static CORE_API FSharedMemoryRegionMapNamedSharedMemoryRegion (const FString &Name, bool bCreate, uint32 AccessMode, SIZE_T Size)
 
static CORE_API bool UnmapNamedSharedMemoryRegion (FSharedMemoryRegion *MemoryRegion)
 
static UE_FORCEINLINE_HINT bool SupportsFastVRAMMemory ()
 
static CORE_API bool IsExtraDevelopmentMemoryAvailable ()
 
static CORE_API uint64 GetExtraDevelopmentMemorySize ()
 
static uint64 GetProgramSize ()
 
static void SetProgramSize (uint64 InProgramSize)
 
static CORE_API bool GetLLMAllocFunctions (void *(*&OutAllocFunction)(size_t), void(*&OutFreeFunction)(void *, size_t), int32 &OutAlignment)
 
static UE_FORCEINLINE_HINT void OnLowLevelMemory_Alloc (void const *Pointer, uint64 Size, uint64 Tag)
 
static UE_FORCEINLINE_HINT void OnLowLevelMemory_Free (void const *Pointer, uint64 Size, uint64 Tag)
 
static void RegisterCustomLLMTags ()
 
static void UpdateCustomLLMTags ()
 
static bool TracksLLMAllocations ()
 
static bool HasForkPageProtectorEnabled ()
 
static bool GetForkedPageAllocationInfo (TArray< FForkedPageAllocation > &OutPageAllocationInfos)
 
static CORE_API FString PrettyMemory (uint64 Memory)
 
static UE_FORCEINLINE_HINT bool CanOverallocateVirtualMemory ()
 

Static Protected Member Functions

static CORE_API void InternalUpdateStats (const FPlatformMemoryStats &MemoryStats)
 
- Static Protected Member Functions inherited from FGenericPlatformMemory
static CORE_API void InternalUpdateStats (const FPlatformMemoryStats &MemoryStats)
 

Friends

struct FGenericStatsUpdater
 

Additional Inherited Members

- Static Public Attributes inherited from FGenericPlatformMemory
static CORE_API bool bIsOOM = false
 
static CORE_API uint64 OOMAllocationSize = 0
 
static CORE_API uint32 OOMAllocationAlignment = 0
 
static CORE_API voidBackupOOMMemoryPool = nullptr
 
static CORE_API uint32 BackupOOMMemoryPoolSize
 
static CORE_API EMemoryAllocatorToUse AllocatorToUse = Platform
 
- Static Protected Attributes inherited from FGenericPlatformMemory
static CORE_API uint64 ProgramSize = 0
 

Detailed Description

Windows implementation of the memory OS functions

Member Enumeration Documentation

◆ EMemoryCounterRegion

Enumerator
MCR_Invalid 
MCR_Physical 
MCR_GPU 
MCR_GPUSystem 
MCR_TexturePool 
MCR_StreamingPool 
MCR_UsedStreamingPool 
MCR_GPUDefragPool 
MCR_SamplePlatformSpecifcMemoryRegion 
MCR_PhysicalLLM 
MCR_MAX 

Member Function Documentation

◆ BaseAllocator()

FMalloc * FWindowsPlatformMemory::BaseAllocator ( )
static

◆ BinnedAllocFromOS()

void * FWindowsPlatformMemory::BinnedAllocFromOS ( SIZE_T  Size)
static

◆ BinnedFreeToOS()

void FWindowsPlatformMemory::BinnedFreeToOS ( void Ptr,
SIZE_T  Size 
)
static

◆ GetBackMemoryPoolSize()

static uint32 FWindowsPlatformMemory::GetBackMemoryPoolSize ( )
inlinestatic

Value determined by series of tests on Fortnite with limited process memory. 26MB sufficed to report all test crashes, using 32MB to have some slack. If this pool is too large, use the following values to determine proper size: 2MB pool allowed to report 78% of crashes. 6MB pool allowed to report 90% of crashes.

◆ GetConstants()

const FPlatformMemoryConstants & FWindowsPlatformMemory::GetConstants ( )
static

◆ GetLLMAllocFunctions()

static CORE_API bool FWindowsPlatformMemory::GetLLMAllocFunctions ( void *(*&)(size_t OutAllocFunction,
void(*&)(void *, size_t OutFreeFunction,
int32 OutAlignment 
)
static

◆ GetStats()

FPlatformMemoryStats FWindowsPlatformMemory::GetStats ( )
static

GlobalMemoryStatusEx MEMORYSTATUSEX ullTotalPhys ullAvailPhys ullTotalVirtual ullAvailVirtual

GetProcessMemoryInfo PROCESS_MEMORY_COUNTERS WorkingSetSize UsedVirtual PeakUsedVirtual

GetPerformanceInfo PPERFORMANCE_INFORMATION PageSize

If we are running as part of a Windows job (e.g. in a docker container), we report those limits instead.

◆ GetStatsForMallocProfiler()

void FWindowsPlatformMemory::GetStatsForMallocProfiler ( FGenericMemoryStats out_Stats)
static

◆ Init()

void FWindowsPlatformMemory::Init ( )
static

◆ InternalUpdateStats()

void FWindowsPlatformMemory::InternalUpdateStats ( const FPlatformMemoryStats MemoryStats)
staticprotected

◆ MapNamedSharedMemoryRegion()

FPlatformMemory::FSharedMemoryRegion * FWindowsPlatformMemory::MapNamedSharedMemoryRegion ( const FString &  InName,
bool  bCreate,
uint32  AccessMode,
SIZE_T  Size,
const void pSecurityAttributes = nullptr 
)
static

◆ MiMallocInit()

void FWindowsPlatformMemory::MiMallocInit ( )
static

LLM uses these low level functions (LLMAlloc and LLMFree) to allocate memory. It grabs the function pointers by calling FPlatformMemory::GetLLMAllocFunctions. If these functions are not implemented GetLLMAllocFunctions should return false and LLM will be disabled.

◆ PageProtect()

bool FWindowsPlatformMemory::PageProtect ( void *const  Ptr,
const SIZE_T  Size,
const bool  bCanRead,
const bool  bCanWrite 
)
static

◆ UnmapNamedSharedMemoryRegion()

bool FWindowsPlatformMemory::UnmapNamedSharedMemoryRegion ( FSharedMemoryRegion MemoryRegion)
static

Friends And Related Symbol Documentation

◆ FGenericStatsUpdater


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