Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FMalloc Class Referenceabstract

#include <MemoryBase.h>

+ Inheritance diagram for FMalloc:
+ Collaboration diagram for FMalloc:

Public Member Functions

virtual voidMalloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
 
virtual voidTryMalloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
virtual voidRealloc (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
 
virtual voidTryRealloc (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
virtual void Free (void *Original)=0
 
virtual SIZE_T QuantizeSize (SIZE_T Count, uint32 Alignment)
 
virtual bool GetAllocationSize (void *Original, SIZE_T &SizeOut)
 
virtual void Trim (bool bTrimThreadCaches)
 
virtual void SetupTLSCachesOnCurrentThread ()
 
virtual void ClearAndDisableTLSCachesOnCurrentThread ()
 
virtual void InitializeStatsMetadata ()
 
virtual void UpdateStats ()
 
virtual void GetAllocatorStats (FGenericMemoryStats &out_Stats)
 
virtual void DumpAllocatorStats (class FOutputDevice &Ar)
 
virtual bool IsInternallyThreadSafe () const
 
virtual bool ValidateHeap ()
 
virtual const TCHAR * GetDescriptiveName ()
 
virtual void OnMallocInitialized ()
 
virtual void OnPreFork ()
 
virtual void OnPostFork ()
 
- Public Member Functions inherited from FUseSystemMallocForNew
voidoperator new (size_t Size)
 
void operator delete (void *Ptr)
 
voidoperator new[] (size_t Size)
 
void operator delete[] (void *Ptr)
 
- Public Member Functions inherited from FExec
virtual ~FExec ()
 
virtual bool Exec (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 

Static Public Attributes

static TAtomic< uint64MaxSingleAlloc
 

Friends

struct FCurrentFrameCalls
 

Additional Inherited Members

- Protected Member Functions inherited from FExec
virtual bool Exec_Dev (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 
virtual bool Exec_Editor (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 

Detailed Description

The global memory allocator's interface.

Definition at line 82 of file MemoryBase.h.

Member Function Documentation

◆ ClearAndDisableTLSCachesOnCurrentThread()

virtual void FMalloc::ClearAndDisableTLSCachesOnCurrentThread ( )
inlinevirtual

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

Reimplemented in FMallocBinned2, FMallocCallstackHandler, and FMallocPoisonProxy.

Definition at line 155 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ DumpAllocatorStats()

virtual void FMalloc::DumpAllocatorStats ( class FOutputDevice & Ar)
inlinevirtual

Dumps current allocator stats to the log.

Reimplemented in FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, and FMallocDebug.

Definition at line 181 of file MemoryBase.h.

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

◆ Free()

virtual void FMalloc::Free ( void * Original)
pure virtual

◆ GetAllocationSize()

virtual bool FMalloc::GetAllocationSize ( void * Original,
SIZE_T & SizeOut )
inlinevirtual

If possible determine the size of the memory allocated at the given address

Parameters
Original- Pointer to memory we are checking the size of
SizeOut- If possible, this value is set to the size of the passed in pointer
Returns
true if succeeded

Reimplemented in FGenericPlatformMallocCrash, FMallocAnsi, FMallocBinned, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, FMallocThreadSafeProxy, and FMallocBinned2.

Definition at line 133 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ GetAllocatorStats()

virtual void FMalloc::GetAllocatorStats ( FGenericMemoryStats & out_Stats)
virtual

Writes allocator stats from the last update into the specified destination.

Reimplemented in FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

+ Here is the caller graph for this function:

◆ GetDescriptiveName()

virtual const TCHAR * FMalloc::GetDescriptiveName ( )
inlinevirtual

Gets descriptive name for logging purposes.

Returns
pointer to human-readable malloc name

Reimplemented in FGenericPlatformMallocCrash, FGenericStackBasedMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 208 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ InitializeStatsMetadata()

virtual void FMalloc::InitializeStatsMetadata ( )
virtual

Initializes stats metadata. We need to do this as soon as possible, but cannot be done in the constructor due to the FName::StaticInit

Reimplemented in FMallocBinned, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

+ Here is the caller graph for this function:

◆ IsInternallyThreadSafe()

virtual bool FMalloc::IsInternallyThreadSafe ( ) const
inlinevirtual

Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it.

Reimplemented in FGenericPlatformMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 190 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ Malloc()

virtual void * FMalloc::Malloc ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
pure virtual

◆ OnMallocInitialized()

virtual void FMalloc::OnMallocInitialized ( )
inlinevirtual

Notifies the malloc implementation that initialization of all allocators in GMalloc is complete, so it's safe to initialize any extra features that require "regular" allocations

Reimplemented in FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 216 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ OnPostFork()

virtual void FMalloc::OnPostFork ( )
inlinevirtual

Notifies the malloc implementation that the process has forked so we can try and avoid dirtying pre-fork pages.

Reimplemented in FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 226 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ OnPreFork()

virtual void FMalloc::OnPreFork ( )
inlinevirtual

Notifies the malloc implementation that the process is about to fork. May be used to trim caches etc.

Reimplemented in FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 221 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ QuantizeSize()

virtual SIZE_T FMalloc::QuantizeSize ( SIZE_T Count,
uint32 Alignment )
inlinevirtual

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.

Reimplemented in FMallocBinned, FMallocBinned2, FMallocCallstackHandler, and FMallocPoisonProxy.

Definition at line 121 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ Realloc()

virtual void * FMalloc::Realloc ( void * Original,
SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
pure virtual

◆ SetupTLSCachesOnCurrentThread()

virtual void FMalloc::SetupTLSCachesOnCurrentThread ( )
inlinevirtual

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

Reimplemented in FMallocBinned2, FMallocCallstackHandler, and FMallocPoisonProxy.

Definition at line 148 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ Trim()

virtual void FMalloc::Trim ( bool bTrimThreadCaches)
inlinevirtual

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

Reimplemented in FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 141 of file MemoryBase.h.

+ Here is the caller graph for this function:

◆ TryMalloc()

virtual void * FMalloc::TryMalloc ( SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
virtual

TryMalloc - like Malloc(), but may return a nullptr result if the allocation request cannot be satisfied.

Reimplemented in FMallocAnsi.

◆ TryRealloc()

virtual void * FMalloc::TryRealloc ( void * Original,
SIZE_T Count,
uint32 Alignment = DEFAULT_ALIGNMENT )
virtual

TryRealloc - like Realloc(), but may return a nullptr if the allocation request cannot be satisfied. Note that in this case the memory pointed to by Original will still be valid

Reimplemented in FMallocAnsi.

◆ UpdateStats()

virtual void FMalloc::UpdateStats ( )
virtual

Handles any commands passed in on the command line This was commented out to make initial build -wooly Called once per frame, gathers and sets all memory allocator statistics into the corresponding stats. MUST BE THREAD SAFE.

Reimplemented in FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocFrameProfiler, and FMallocPoisonProxy.

+ Here is the caller graph for this function:

◆ ValidateHeap()

virtual bool FMalloc::ValidateHeap ( )
inlinevirtual

Validates the allocator's heap

Reimplemented in FGenericPlatformMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, and FMallocThreadSafeProxy.

Definition at line 198 of file MemoryBase.h.

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ FCurrentFrameCalls

friend struct FCurrentFrameCalls
friend

Definition at line 229 of file MemoryBase.h.

Member Data Documentation

◆ MaxSingleAlloc

TAtomic<uint64> FMalloc::MaxSingleAlloc
static

Limits the maximum single allocation, to this many bytes, for debugging

Definition at line 234 of file MemoryBase.h.


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