engine
 
载入中...
搜索中...
未找到
类 | Public 类型 | 静态 Public 成员函数 | 静态 Public 属性 | 所有成员列表
FGenericPlatformMemory结构体 参考

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

#include <GenericPlatformMemory.h>

+ 类 FGenericPlatformMemory 继承关系图:

类

struct  FSharedMemoryRegion
 Generic representation of a shared memory region 更多...
 

Public 类型

enum  EMemoryAllocatorToUse
 Which allocator is being used
 
enum  EMemoryCounterRegion
 Various memory regions that can be used with memory stats. 更多...
 
enum  ESharedMemoryAccess
 Flags used for shared memory creation/open
 

静态 Public 成员函数

static FMalloc * BaseAllocator ()
 
static void * BinnedAllocFromOS (SIZE_T Size)
 Allocates pages from the OS. 更多...
 
static void BinnedFreeToOS (void *Ptr, SIZE_T Size)
 Returns pages allocated by BinnedAllocFromOS to the OS. 更多...
 
static bool BinnedPlatformHasMemoryPoolForThisSize (SIZE_T Size)
 Some platforms may pool allocations of this size to reduce OS calls. 更多...
 
static void DumpPlatformAndAllocatorStats (FOutputDevice &Ar)
 Dumps basic platform memory statistics and allocator specific statistics into the specified output device.
 
static void DumpStats (FOutputDevice &Ar)
 Dumps basic platform memory statistics into the specified output device.
 
static uint32 GetBackMemoryPoolSize ()
 
static const FPlatformMemoryConstants & GetConstants ()
 
static EPlatformMemorySizeBucket GetMemorySizeBucket ()
 Return which "high level", per platform, memory bucket we are in
 
static uint64 GetMemoryUsedFast ()
 
static uint32 GetPhysicalGBRam ()
 
static FPlatformMemoryStats GetStats ()
 
static void GetStatsForMallocProfiler (FGenericMemoryStats &out_Stats)
 Writes all platform specific current memory statistics in the format usable by the malloc profiler.
 
static void Init ()
 Initializes platform memory specific constants.
 
static bool IsNanoMallocAvailable ()
 Nano Malloc is Apple's tiny block allocator. 更多...
 
static void NanoMallocInit ()
 Performs initial setup for Nano malloc. 更多...
 
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. 更多...
 
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. 更多...
 
static bool PtrIsOSMalloc (void *Ptr)
 Was this pointer allocated by the OS malloc? Currently only Apple platforms implement this to detect small block allocations. 更多...
 
static void SetupMemoryPools ()
 Initializes the memory pools, should be called by the init function.
 

静态 Public 属性

static EMemoryAllocatorToUse AllocatorToUse
 Current allocator
 
static void * BackupOOMMemoryPool
 Preallocated buffer to delete on out of memory. 更多...
 
static uint32 BackupOOMMemoryPoolSize
 Size of BackupOOMMemoryPool in bytes.
 
static bool bIsOOM
 Set to true if we encounters out of memory.
 
static uint32 OOMAllocationAlignment
 Set to alignment of allocation that triggered out of memory, zero otherwise.
 
static uint64 OOMAllocationSize
 Set to size of allocation that triggered out of memory, zero otherwise.
 

Memory functions

struct FGenericStatsUpdater
 
static FORCEINLINE void * Memmove (void *Dest, const void *Src, SIZE_T Count)
 Copies count bytes of characters from Src to Dest. 更多...
 
static FORCEINLINE int32 Memcmp (const void *Buf1, const void *Buf2, SIZE_T Count)
 
static FORCEINLINE void * Memset (void *Dest, uint8 Char, SIZE_T Count)
 
static FORCEINLINE void * Memzero (void *Dest, SIZE_T Count)
 
static FORCEINLINE void * Memcpy (void *Dest, const void *Src, SIZE_T Count)
 
static FORCEINLINE void * BigBlockMemcpy (void *Dest, const void *Src, SIZE_T Count)
 Memcpy optimized for big blocks.
 
static FORCEINLINE 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
 
static void Memswap (void *Ptr1, void *Ptr2, SIZE_T Size)
 
template<typename T >
static FORCEINLINE T ReadUnaligned (const void *Ptr)
 Loads a simple POD type from unaligned memory. 更多...
 
template<typename T >
static FORCEINLINE void WriteUnaligned (void *Ptr, const T &InValue)
 Stores a simple POD type to unaligned memory. 更多...
 
static FSharedMemoryRegion * 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) 更多...
 
static bool UnmapNamedSharedMemoryRegion (FSharedMemoryRegion *MemoryRegion)
 Unmaps a name shared memory region 更多...
 
static FORCEINLINE bool SupportsFastVRAMMemory ()
 Gets whether this platform supports Fast VRAM memory Ie, whether TexCreate_FastVRAM flags actually mean something or not 更多...
 
static bool IsExtraDevelopmentMemoryAvailable ()
 Returns true if debug memory has been assigned to the title for general use. 更多...
 
static uint64 GetExtraDevelopmentMemorySize ()
 Returns >0 if debug memory has been assigned to the title for general use. 更多...
 
static bool GetLLMAllocFunctions (void *(*&OutAllocFunction)(size_t), void(*&OutFreeFunction)(void *, size_t), int32 &OutAlignment)
 This function sets AllocFunction and FreeFunction and returns true, or just returns false. 更多...
 
static FORCEINLINE void OnLowLevelMemory_Alloc (void const *Pointer, uint64 Size, uint64 Tag)
 Called for all default tracker LLM allocations and frees, when LLM is enabled. 更多...
 
static FORCEINLINE void OnLowLevelMemory_Free (void const *Pointer, uint64 Size, uint64 Tag)
 
static void UpdateCustomLLMTags ()
 Called once per frame when LLM is collating the data for the current frame. 更多...
 
template<typename U >
struct __attribute__ ((packed)) TUnaligned
 
static void InternalUpdateStats (const FPlatformMemoryStats &MemoryStats)
 Updates platform specific stats. 更多...
 

详细描述

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

成员枚举类型说明

◆ EMemoryCounterRegion

Various memory regions that can be used with memory stats.

The exact meaning of the enums are relatively platform-dependent, although the general ones (Physical, GPU) are straightforward. A platform can add more of these, and it won't affect other platforms, other than a minuscule amount of memory for the StatManager to track the max available memory for each region (uses an array FPlatformMemory::MCR_MAX big)

成员函数说明

◆ BaseAllocator()

static FMalloc * FGenericPlatformMemory::BaseAllocator ( )
static
返回
the default allocator.

◆ BinnedAllocFromOS()

static void * FGenericPlatformMemory::BinnedAllocFromOS ( SIZE_T  Size)
static

Allocates pages from the OS.

参数
SizeSize to allocate, not necessarily aligned
返回
OS allocated pointer for use by binned allocator

◆ BinnedFreeToOS()

static void FGenericPlatformMemory::BinnedFreeToOS ( void *  Ptr,
SIZE_T  Size 
)
static

Returns pages allocated by BinnedAllocFromOS to the OS.

参数
Apointer previously returned from BinnedAllocFromOS
Sizesize of the allocation previously passed to BinnedAllocFromOS

◆ BinnedPlatformHasMemoryPoolForThisSize()

static bool FGenericPlatformMemory::BinnedPlatformHasMemoryPoolForThisSize ( SIZE_T  Size)
inlinestatic

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

This function serves as a hint for BinnedMalloc's CachedOSPageAllocator so it does not cache these allocations additionally

◆ GetBackMemoryPoolSize()

static uint32 FGenericPlatformMemory::GetBackMemoryPoolSize ( )
inlinestatic
返回
how much memory the platform should pre-allocate for crash handling (this will be allocated ahead of time, and freed when system runs out of memory).

◆ GetConstants()

static const FPlatformMemoryConstants & FGenericPlatformMemory::GetConstants ( )
static
返回
platform specific memory constants.

◆ GetExtraDevelopmentMemorySize()

static uint64 FGenericPlatformMemory::GetExtraDevelopmentMemorySize ( )
static

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

Only applies to platforms with fixed memory and no paging.

◆ GetLLMAllocFunctions()

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

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

These functions are the platform dependant low low low level functions that LLM uses to allocate memory.

◆ GetMemoryUsedFast()

static uint64 FGenericPlatformMemory::GetMemoryUsedFast ( )
inlinestatic
返回
memory used for platforms that can do it quickly (without affecting stat unit much)

◆ GetPhysicalGBRam()

static uint32 FGenericPlatformMemory::GetPhysicalGBRam ( )
static
返回
approximate physical RAM in GB.

◆ GetStats()

static FPlatformMemoryStats FGenericPlatformMemory::GetStats ( )
static
返回
platform specific current memory statistics.

◆ InternalUpdateStats()

static void FGenericPlatformMemory::InternalUpdateStats ( const FPlatformMemoryStats &  MemoryStats)
staticprotected

Updates platform specific stats.

This method is called through FGenericStatsUpdater from the task graph thread.

◆ IsExtraDevelopmentMemoryAvailable()

static bool FGenericPlatformMemory::IsExtraDevelopmentMemoryAvailable ( )
static

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

Only applies to platforms with fixed memory and no paging.

◆ IsNanoMallocAvailable()

static bool FGenericPlatformMemory::IsNanoMallocAvailable ( )
inlinestatic

Nano Malloc is Apple's tiny block allocator.

Does the Nano malloc zone exist?

返回
True if Nano malloc is enabled and available.

◆ MapNamedSharedMemoryRegion()

static FSharedMemoryRegion * FGenericPlatformMemory::MapNamedSharedMemoryRegion ( const FString &  Name,
bool  bCreate,
uint32  AccessMode,
SIZE_T  Size 
)
static

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

参数
Nameunique name of the shared memory region (should not contain [back]slashes to remain cross-platform).
bCreatewhether we're creating it or just opening existing (created by some other process).
AccessModemode which we will be accessing it (use values from ESharedMemoryAccess)
Sizesize of the buffer (should be >0. Also, the real size is subject to platform limitations and may be increased to match page size)
返回
pointer to FSharedMemoryRegion (or its descendants) if successful, NULL if not.

◆ Memmove()

static FORCEINLINE void * FGenericPlatformMemory::Memmove ( void *  Dest,
const void *  Src,
SIZE_T  Count 
)
inlinestatic

Copies count bytes of characters from Src to Dest.

If some regions of the source area and the destination overlap, memmove ensures that the original source bytes in the overlapping region are copied before being overwritten. NOTE: make sure that the destination buffer is the same size or larger than the source buffer!

◆ NanoMallocInit()

static void FGenericPlatformMemory::NanoMallocInit ( )
inlinestatic

Performs initial setup for Nano malloc.

This is a noop on non-apple platforms

◆ OnLowLevelMemory_Alloc()

static FORCEINLINE void FGenericPlatformMemory::OnLowLevelMemory_Alloc ( void const *  Pointer,
uint64  Size,
uint64  Tag 
)
inlinestatic

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

Provides a single alloc/free hook that platforms can implement to support platform specific memory analysis tools.

◆ PageProtect()

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

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

参数
PtrAddress to the starting page of the region of pages whose access protection attributes are to be changed.
SizeThe size of the region whose access protection attributes are to be changed, in bytes.
bCanReadCan the memory be read.
bCanWriteCan the memory be written to.
返回
True if the specified pages' protection mode was changed.

◆ PtrIsFromNanoMalloc()

static bool FGenericPlatformMemory::PtrIsFromNanoMalloc ( void *  Ptr)
inlinestatic

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

参数
Thepointer to query
返回
True if this pointer is in the Nano Malloc Region

◆ PtrIsOSMalloc()

static bool FGenericPlatformMemory::PtrIsOSMalloc ( void *  Ptr)
inlinestatic

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

参数
Thepointer to query
返回
True if this pointer was allocated by the OS.

◆ ReadUnaligned()

template<typename T >
static FORCEINLINE T FGenericPlatformMemory::ReadUnaligned ( const void *  Ptr)
inlinestatic

Loads a simple POD type from unaligned memory.

参数
Ptrunaligned memory of at least size sizeof(T)
返回
Value at Ptr

◆ SupportsFastVRAMMemory()

static FORCEINLINE bool FGenericPlatformMemory::SupportsFastVRAMMemory ( )
inlinestatic

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

返回
bool true if supported, false if not

◆ UnmapNamedSharedMemoryRegion()

static bool FGenericPlatformMemory::UnmapNamedSharedMemoryRegion ( FSharedMemoryRegion *  MemoryRegion)
static

Unmaps a name shared memory region

参数
MemoryRegionan object that encapsulates a shared memory region (will be destroyed even if function fails!)
返回
true if successful

◆ UpdateCustomLLMTags()

static void FGenericPlatformMemory::UpdateCustomLLMTags ( )
inlinestatic

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

Can be used to set platform-specific calculated tag data via SetTagAmountForTracker

◆ WriteUnaligned()

template<typename T >
static FORCEINLINE void FGenericPlatformMemory::WriteUnaligned ( void *  Ptr,
const T &  InValue 
)
inlinestatic

Stores a simple POD type to unaligned memory.

参数
Ptrunaligned memory of at least size sizeof(T)
Valuevalue to write at Ptr

类成员变量说明

◆ BackupOOMMemoryPool

void* FGenericPlatformMemory::BackupOOMMemoryPool
static

Preallocated buffer to delete on out of memory.

Used by OOM handling and crash reporting.


该结构体的文档由以下文件生成: