Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FMemory Struct Reference

#include <UnrealMemory.h>

Public Types

enum  AllocationHints {
  None = -1 , Default , Temporary , SmallPool ,
  Max
}
 

Memory functions (wrapper for FPlatformMemory)

static FORCEINLINE voidMemmove (void *Dest, const void *Src, SIZE_T Count)
 
static FORCEINLINE int32 Memcmp (const void *Buf1, const void *Buf2, SIZE_T Count)
 
static FORCEINLINE voidMemset (void *Dest, uint8 Char, SIZE_T Count)
 
template<class T >
static FORCEINLINE void Memset (T &Src, uint8 ValueToSet)
 
static FORCEINLINE voidMemzero (void *Dest, SIZE_T Count)
 
static FORCEINLINE bool MemIsZero (const void *Ptr, SIZE_T Count)
 
template<class T >
static FORCEINLINE void Memzero (T &Src)
 
static FORCEINLINE voidMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
template<class T >
static FORCEINLINE void Memcpy (T &Dest, const T &Src)
 
static FORCEINLINE voidBigBlockMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
static FORCEINLINE voidStreamingMemcpy (void *Dest, const void *Src, SIZE_T Count)
 
static FORCEINLINE voidParallelMemcpy (void *Dest, const void *Src, SIZE_T Count, EMemcpyCachePolicy Policy=EMemcpyCachePolicy::StoreCached)
 
static FORCEINLINE void Memswap (void *Ptr1, void *Ptr2, SIZE_T Size)
 
static FORCEINLINE voidSystemMalloc (SIZE_T Size)
 
static FORCEINLINE void SystemFree (void *Ptr)
 
static voidMalloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static voidRealloc (void *Original, SIZE_T Size, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static void Free (void *Original)
 
static SIZE_T GetAllocSize (void *Original)
 
static FORCEINLINE_DEBUGGABLE voidMallocZeroed (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static SIZE_T QuantizeSize (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static void Trim (bool bTrimThreadCaches=true)
 
static void SetupTLSCachesOnCurrentThread ()
 
static void ClearAndDisableTLSCachesOnCurrentThread ()
 
static void TestMemory ()
 
static void EnablePurgatoryTests ()
 
static void EnablePoisonTests ()
 
static void ExplicitInit (FMalloc &Allocator)
 
static void RegisterPersistentAuxiliary (void *InMemory, SIZE_T InSize)
 
static voidMallocPersistentAuxiliary (SIZE_T InSize, uint32 InAlignment=0)
 
static void FreePersistentAuxiliary (void *InPtr)
 
static bool IsPersistentAuxiliaryActive ()
 
static void DisablePersistentAuxiliary ()
 
static void EnablePersistentAuxiliary ()
 
static SIZE_T GetUsedPersistentAuxiliary ()
 
static void GCreateMalloc ()
 
static voidMallocExternal (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static voidReallocExternal (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
static void FreeExternal (void *Original)
 
static SIZE_T GetAllocSizeExternal (void *Original)
 
static SIZE_T QuantizeSizeExternal (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 

Detailed Description

Definition at line 93 of file UnrealMemory.h.

Member Enumeration Documentation

◆ AllocationHints

Some allocators can be given hints to treat allocations differently depending on how the memory is used, it's lifetime etc.

Enumerator
None 
Default 
Temporary 
SmallPool 
Max 

Definition at line 96 of file UnrealMemory.h.

Member Function Documentation

◆ BigBlockMemcpy()

static FORCEINLINE void * FMemory::BigBlockMemcpy ( void * Dest,
const void * Src,
SIZE_T Count )
inlinestatic

Definition at line 172 of file UnrealMemory.h.

+ Here is the call graph for this function:

◆ ClearAndDisableTLSCachesOnCurrentThread()

static void FMemory::ClearAndDisableTLSCachesOnCurrentThread ( )
static

Clears the TLS caches on the current thread and disables any future caching.

◆ DisablePersistentAuxiliary()

static void FMemory::DisablePersistentAuxiliary ( )
static

◆ EnablePersistentAuxiliary()

static void FMemory::EnablePersistentAuxiliary ( )
static

◆ EnablePoisonTests()

static void FMemory::EnablePoisonTests ( )
static

Called once main is started and we have -purgatorymallocproxy. This uses the purgatory malloc proxy to check if things are writing to stale pointers.

◆ EnablePurgatoryTests()

static void FMemory::EnablePurgatoryTests ( )
static

Called once main is started and we have -purgatorymallocproxy. This uses the purgatory malloc proxy to check if things are writing to stale pointers.

◆ ExplicitInit()

static void FMemory::ExplicitInit ( FMalloc & Allocator)
static

Set global allocator instead of creating it lazily on first allocation. Must only be called once and only if lazy init is disabled via a macro.

◆ Free()

static void FMemory::Free ( void * Original)
inlinestatic

Definition at line 225 of file UnrealMemory.h.

+ Here is the caller graph for this function:

◆ FreeExternal()

static void FMemory::FreeExternal ( void * Original)
staticprivate

◆ FreePersistentAuxiliary()

static void FMemory::FreePersistentAuxiliary ( void * InPtr)
static

◆ GCreateMalloc()

static void FMemory::GCreateMalloc ( )
staticprivate

◆ GetAllocSize()

static SIZE_T FMemory::GetAllocSize ( void * Original)
static

◆ GetAllocSizeExternal()

static SIZE_T FMemory::GetAllocSizeExternal ( void * Original)
staticprivate

◆ GetUsedPersistentAuxiliary()

static SIZE_T FMemory::GetUsedPersistentAuxiliary ( )
static

◆ IsPersistentAuxiliaryActive()

static bool FMemory::IsPersistentAuxiliaryActive ( )
static

◆ Malloc()

static void * FMemory::Malloc ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
inlinestatic

Definition at line 211 of file UnrealMemory.h.

+ Here is the caller graph for this function:

◆ MallocExternal()

static void * FMemory::MallocExternal ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
staticprivate

◆ MallocPersistentAuxiliary()

static void * FMemory::MallocPersistentAuxiliary ( SIZE_T InSize,
uint32 InAlignment = 0 )
static

◆ MallocZeroed()

static FORCEINLINE_DEBUGGABLE void * FMemory::MallocZeroed ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
inlinestatic

Definition at line 231 of file UnrealMemory.h.

+ Here is the call graph for this function:

◆ Memcmp()

static FORCEINLINE int32 FMemory::Memcmp ( const void * Buf1,
const void * Buf2,
SIZE_T Count )
inlinestatic

Definition at line 114 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Memcpy() [1/2]

template<class T >
static FORCEINLINE void FMemory::Memcpy ( T & Dest,
const T & Src )
inlinestatic

Definition at line 166 of file UnrealMemory.h.

◆ Memcpy() [2/2]

static FORCEINLINE void * FMemory::Memcpy ( void * Dest,
const void * Src,
SIZE_T Count )
inlinestatic

Definition at line 160 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MemIsZero()

static FORCEINLINE bool FMemory::MemIsZero ( const void * Ptr,
SIZE_T Count )
inlinestatic

Returns true if memory is zeroes, false otherwise.

Definition at line 137 of file UnrealMemory.h.

◆ Memmove()

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

Definition at line 109 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Memset() [1/2]

template<class T >
static FORCEINLINE void FMemory::Memset ( T & Src,
uint8 ValueToSet )
inlinestatic

Definition at line 125 of file UnrealMemory.h.

◆ Memset() [2/2]

static FORCEINLINE void * FMemory::Memset ( void * Dest,
uint8 Char,
SIZE_T Count )
inlinestatic

Definition at line 119 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Memswap()

static FORCEINLINE void FMemory::Memswap ( void * Ptr1,
void * Ptr2,
SIZE_T Size )
inlinestatic

Definition at line 187 of file UnrealMemory.h.

+ Here is the call graph for this function:

◆ Memzero() [1/2]

template<class T >
static FORCEINLINE void FMemory::Memzero ( T & Src)
inlinestatic

Definition at line 154 of file UnrealMemory.h.

◆ Memzero() [2/2]

static FORCEINLINE void * FMemory::Memzero ( void * Dest,
SIZE_T Count )
inlinestatic

Definition at line 131 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ParallelMemcpy()

static FORCEINLINE void * FMemory::ParallelMemcpy ( void * Dest,
const void * Src,
SIZE_T Count,
EMemcpyCachePolicy Policy = EMemcpyCachePolicy::StoreCached )
inlinestatic

Definition at line 182 of file UnrealMemory.h.

+ Here is the call graph for this function:

◆ QuantizeSize()

static SIZE_T FMemory::QuantizeSize ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
inlinestatic

For some allocators this will return the actual size that should be requested to eliminate internal fragmentation. The return value will always be >= Count. This can be used to grow and shrink containers to optimal sizes. This call is always fast and threadsafe with no locking.

Definition at line 244 of file UnrealMemory.h.

◆ QuantizeSizeExternal()

static SIZE_T FMemory::QuantizeSizeExternal ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
staticprivate

◆ Realloc()

static void * FMemory::Realloc ( void * Original,
SIZE_T Size,
uint32 Alignment = DEFAULT_ALIGNMENT )
inlinestatic

Definition at line 218 of file UnrealMemory.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReallocExternal()

static void * FMemory::ReallocExternal ( void * Original,
SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
staticprivate

◆ RegisterPersistentAuxiliary()

static void FMemory::RegisterPersistentAuxiliary ( void * InMemory,
SIZE_T InSize )
static

Functions to handle special memory given to the title from the platform This memory is allocated like a stack, it's never really freed

◆ SetupTLSCachesOnCurrentThread()

static void FMemory::SetupTLSCachesOnCurrentThread ( )
static

Set up TLS caches on the current thread. These are the threads that we can trim.

◆ StreamingMemcpy()

static FORCEINLINE void * FMemory::StreamingMemcpy ( void * Dest,
const void * Src,
SIZE_T Count )
inlinestatic

Definition at line 177 of file UnrealMemory.h.

+ Here is the call graph for this function:

◆ SystemFree()

static FORCEINLINE void FMemory::SystemFree ( void * Ptr)
inlinestatic

Definition at line 201 of file UnrealMemory.h.

◆ SystemMalloc()

static FORCEINLINE void * FMemory::SystemMalloc ( SIZE_T Size)
inlinestatic

Definition at line 195 of file UnrealMemory.h.

◆ TestMemory()

static void FMemory::TestMemory ( )
static

A helper function that will perform a series of random heap allocations to test the internal validity of the heap. Note, this function will "leak" memory, but another call will clean up previously allocated blocks before returning. This will help to A/B testing where you call it in a good state, do something to corrupt memory, then call this again and hopefully freeing some pointers will trigger a crash.

◆ Trim()

static void FMemory::Trim ( bool bTrimThreadCaches = true)
static

Releases as much memory as possible. Must be called from the main thread.


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