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.
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)
|
static |
|
static |
Allocates pages from the OS.
| Size | Size to allocate, not necessarily aligned |
|
static |
Returns pages allocated by BinnedAllocFromOS to the OS.
| A | pointer previously returned from BinnedAllocFromOS |
| Size | size of the allocation previously passed to BinnedAllocFromOS |
|
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
|
inlinestatic |
|
static |
|
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.
|
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.
|
inlinestatic |
|
static |
|
static |
|
staticprotected |
Updates platform specific stats.
This method is called through FGenericStatsUpdater from the task graph thread.
|
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.
|
inlinestatic |
Nano Malloc is Apple's tiny block allocator.
Does the Nano malloc zone exist?
|
static |
Maps a named shared memory region into process address space (creates or opens it)
| Name | unique name of the shared memory region (should not contain [back]slashes to remain cross-platform). |
| bCreate | whether we're creating it or just opening existing (created by some other process). |
| AccessMode | mode which we will be accessing it (use values from ESharedMemoryAccess) |
| Size | size of the buffer (should be >0. Also, the real size is subject to platform limitations and may be increased to match page size) |
|
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!
|
inlinestatic |
Performs initial setup for Nano malloc.
This is a noop on non-apple platforms
|
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.
|
static |
Changes the protection on a region of committed pages in the virtual address space.
| Ptr | Address to the starting page of the region of pages whose access protection attributes are to be changed. |
| Size | The size of the region whose access protection attributes are to be changed, in bytes. |
| bCanRead | Can the memory be read. |
| bCanWrite | Can the memory be written to. |
|
inlinestatic |
Was this pointer allocated by in the Nano Malloc Zone? Currently only Apple platforms implement this to detect small block allocations.
| The | pointer to query |
|
inlinestatic |
Was this pointer allocated by the OS malloc? Currently only Apple platforms implement this to detect small block allocations.
| The | pointer to query |
|
inlinestatic |
Loads a simple POD type from unaligned memory.
| Ptr | unaligned memory of at least size sizeof(T) |
|
inlinestatic |
Gets whether this platform supports Fast VRAM memory Ie, whether TexCreate_FastVRAM flags actually mean something or not
|
static |
Unmaps a name shared memory region
| MemoryRegion | an object that encapsulates a shared memory region (will be destroyed even if function fails!) |
|
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
|
inlinestatic |
Stores a simple POD type to unaligned memory.
| Ptr | unaligned memory of at least size sizeof(T) |
| Value | value to write at Ptr |
|
static |
Preallocated buffer to delete on out of memory.
Used by OOM handling and crash reporting.