Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FMallocBinned2 Class Reference

#include <MallocBinned2.h>

+ Inheritance diagram for FMallocBinned2:
+ Collaboration diagram for FMallocBinned2:

Classes

struct  FBundle
 
struct  FBundleNode
 
struct  FFreeBlock
 
struct  FFreeBlockList
 
struct  FPerThreadFreeBlockLists
 
struct  FPoolList
 
struct  FPoolTable
 
struct  FPtrToPoolMapping
 

Public Member Functions

 FMallocBinned2 ()
 
virtual ~FMallocBinned2 ()
 
virtual bool IsInternallyThreadSafe () const override
 
virtual FORCEINLINE voidMalloc (SIZE_T Size, uint32 Alignment) override
 
FORCEINLINE voidMallocInline (SIZE_T Size, uint32 Alignment)
 
FORCEINLINE voidMallocSelect (SIZE_T Size, uint32 Alignment)
 
virtual FORCEINLINE voidRealloc (void *Ptr, SIZE_T NewSize, uint32 Alignment) override
 
FORCEINLINE voidReallocInline (void *Ptr, SIZE_T NewSize, uint32 Alignment)
 
virtual FORCEINLINE void Free (void *Ptr) override
 
FORCEINLINE void FreeInline (void *Ptr)
 
virtual FORCEINLINE bool GetAllocationSize (void *Ptr, SIZE_T &SizeOut) override
 
virtual FORCEINLINE SIZE_T QuantizeSize (SIZE_T Count, uint32 Alignment) override
 
virtual bool ValidateHeap () override
 
virtual void Trim (bool bTrimThreadCaches) override
 
virtual void SetupTLSCachesOnCurrentThread () override
 
virtual void ClearAndDisableTLSCachesOnCurrentThread () override
 
virtual const TCHAR * GetDescriptiveName () override
 
virtual void UpdateStats () override
 
virtual void OnMallocInitialized () override
 
virtual void OnPreFork () override
 
virtual void OnPostFork () override
 
void FlushCurrentThreadCache ()
 
voidMallocExternalSmall (SIZE_T Size, uint32 Alignment)
 
voidMallocExternalLarge (SIZE_T Size, uint32 Alignment)
 
voidReallocExternal (void *Ptr, SIZE_T NewSize, uint32 Alignment)
 
void FreeExternal (void *Ptr)
 
bool GetAllocationSizeExternal (void *Ptr, SIZE_T &SizeOut)
 
void CanaryTest (const FFreeBlock *Block) const
 
void CanaryFail (const FFreeBlock *Block) const
 
int64 GetTotalAllocatedSmallPoolMemory () const
 
virtual void GetAllocatorStats (FGenericMemoryStats &out_Stats) override
 
virtual void DumpAllocatorStats (class FOutputDevice &Ar) override
 
FORCEINLINE uint32 BoundSizeToPoolIndex (SIZE_T Size)
 
FORCEINLINE uint32 PoolIndexToBlockSize (uint32 PoolIndex)
 
- Public Member Functions inherited from FMalloc
virtual voidTryMalloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
virtual voidTryRealloc (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 
virtual void InitializeStatsMetadata ()
 
- 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 Member Functions

static FORCEINLINE bool UseSmallAlloc (SIZE_T Size, uint32 Alignment)
 

Static Public Attributes

static uint16 SmallBlockSizesReversed [BINNED2_SMALL_POOL_COUNT]
 
static FMallocBinned2MallocBinned2
 
static uint32 Binned2TlsSlot
 
static uint32 PageSize
 
static uint32 OsAllocationGranularity
 
static uint8 MemSizeToIndex [1+(BINNED2_MAX_SMALL_POOL_SIZE > > BINNED2_MINIMUM_ALIGNMENT_SHIFT)]
 
- Static Public Attributes inherited from FMalloc
static TAtomic< uint64MaxSingleAlloc
 

Private Member Functions

FORCEINLINE bool IsOSAllocation (const void *Ptr)
 

Static Private Member Functions

static FORCEINLINE FFreeBlockGetPoolHeaderFromPointer (void *Ptr)
 

Private Attributes

FPtrToPoolMapping PtrToPoolMapping
 
FPoolTable SmallPoolTables [BINNED2_SMALL_POOL_COUNT]
 
PoolHashBucketHashBuckets
 
PoolHashBucketHashBucketFreeList
 
uint64 NumPoolsPerPage
 
TCachedOSPageAllocator< BINNED2_MAX_CACHED_OS_FREES, BINNED2_MAX_CACHED_OS_FREES_BYTE_LIMITCachedOSPageAllocator
 
FCriticalSection Mutex
 

Static Private Attributes

static constexpr EBlockCanary CurrentCanary = EBlockCanary::Value
 

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

Definition at line 130 of file MallocBinned2.h.

Constructor & Destructor Documentation

◆ FMallocBinned2()

FMallocBinned2::FMallocBinned2 ( )

◆ ~FMallocBinned2()

virtual FMallocBinned2::~FMallocBinned2 ( )
virtual

Member Function Documentation

◆ BoundSizeToPoolIndex()

FORCEINLINE uint32 FMallocBinned2::BoundSizeToPoolIndex ( SIZE_T Size)
inline

Definition at line 796 of file MallocBinned2.h.

+ Here is the caller graph for this function:

◆ CanaryFail()

void FMallocBinned2::CanaryFail ( const FFreeBlock * Block) const

◆ CanaryTest()

void FMallocBinned2::CanaryTest ( const FFreeBlock * Block) const

◆ ClearAndDisableTLSCachesOnCurrentThread()

virtual void FMallocBinned2::ClearAndDisableTLSCachesOnCurrentThread ( )
overridevirtual

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

Reimplemented from FMalloc.

◆ DumpAllocatorStats()

virtual void FMallocBinned2::DumpAllocatorStats ( class FOutputDevice & Ar)
overridevirtual

Dumps current allocator stats to the log.

Reimplemented from FMalloc.

◆ FlushCurrentThreadCache()

void FMallocBinned2::FlushCurrentThreadCache ( )

◆ Free()

virtual FORCEINLINE void FMallocBinned2::Free ( void * Original)
inlineoverridevirtual

Free

Implements FMalloc.

Definition at line 676 of file MallocBinned2.h.

+ Here is the call graph for this function:

◆ FreeExternal()

void FMallocBinned2::FreeExternal ( void * Ptr)
+ Here is the caller graph for this function:

◆ FreeInline()

FORCEINLINE void FMallocBinned2::FreeInline ( void * Ptr)
inline

Definition at line 702 of file MallocBinned2.h.

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

◆ GetAllocationSize()

virtual FORCEINLINE bool FMallocBinned2::GetAllocationSize ( void * Original,
SIZE_T & SizeOut )
inlineoverridevirtual

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 from FMalloc.

Definition at line 723 of file MallocBinned2.h.

+ Here is the call graph for this function:

◆ GetAllocationSizeExternal()

bool FMallocBinned2::GetAllocationSizeExternal ( void * Ptr,
SIZE_T & SizeOut )
+ Here is the caller graph for this function:

◆ GetAllocatorStats()

virtual void FMallocBinned2::GetAllocatorStats ( FGenericMemoryStats & out_Stats)
overridevirtual

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

Reimplemented from FMalloc.

◆ GetDescriptiveName()

virtual const TCHAR * FMallocBinned2::GetDescriptiveName ( )
overridevirtual

Gets descriptive name for logging purposes.

Returns
pointer to human-readable malloc name

Reimplemented from FMalloc.

◆ GetPoolHeaderFromPointer()

static FORCEINLINE FFreeBlock * FMallocBinned2::GetPoolHeaderFromPointer ( void * Ptr)
inlinestaticprivate

Definition at line 460 of file MallocBinned2.h.

+ Here is the caller graph for this function:

◆ GetTotalAllocatedSmallPoolMemory()

int64 FMallocBinned2::GetTotalAllocatedSmallPoolMemory ( ) const

◆ IsInternallyThreadSafe()

virtual bool FMallocBinned2::IsInternallyThreadSafe ( ) const
overridevirtual

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

Reimplemented from FMalloc.

◆ IsOSAllocation()

FORCEINLINE bool FMallocBinned2::IsOSAllocation ( const void * Ptr)
inlineprivate

Definition at line 301 of file MallocBinned2.h.

+ Here is the caller graph for this function:

◆ Malloc()

virtual FORCEINLINE void * FMallocBinned2::Malloc ( SIZE_T Count,
uint32 Alignment )
inlineoverridevirtual

Malloc

Implements FMalloc.

Definition at line 478 of file MallocBinned2.h.

+ Here is the call graph for this function:

◆ MallocExternalLarge()

void * FMallocBinned2::MallocExternalLarge ( SIZE_T Size,
uint32 Alignment )
+ Here is the caller graph for this function:

◆ MallocExternalSmall()

void * FMallocBinned2::MallocExternalSmall ( SIZE_T Size,
uint32 Alignment )
+ Here is the caller graph for this function:

◆ MallocInline()

FORCEINLINE void * FMallocBinned2::MallocInline ( SIZE_T Size,
uint32 Alignment )
inline

Definition at line 504 of file MallocBinned2.h.

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

◆ MallocSelect()

FORCEINLINE void * FMallocBinned2::MallocSelect ( SIZE_T Size,
uint32 Alignment )
inline

Definition at line 557 of file MallocBinned2.h.

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

◆ OnMallocInitialized()

virtual void FMallocBinned2::OnMallocInitialized ( )
overridevirtual

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 from FMalloc.

◆ OnPostFork()

virtual void FMallocBinned2::OnPostFork ( )
overridevirtual

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

Reimplemented from FMalloc.

◆ OnPreFork()

virtual void FMallocBinned2::OnPreFork ( )
overridevirtual

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

Reimplemented from FMalloc.

◆ PoolIndexToBlockSize()

FORCEINLINE uint32 FMallocBinned2::PoolIndexToBlockSize ( uint32 PoolIndex)
inline

Definition at line 804 of file MallocBinned2.h.

+ Here is the caller graph for this function:

◆ QuantizeSize()

virtual FORCEINLINE SIZE_T FMallocBinned2::QuantizeSize ( SIZE_T Count,
uint32 Alignment )
inlineoverridevirtual

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 from FMalloc.

Definition at line 741 of file MallocBinned2.h.

+ Here is the call graph for this function:

◆ Realloc()

virtual FORCEINLINE void * FMallocBinned2::Realloc ( void * Original,
SIZE_T Count,
uint32 Alignment )
inlineoverridevirtual

Realloc

Implements FMalloc.

Definition at line 572 of file MallocBinned2.h.

+ Here is the call graph for this function:

◆ ReallocExternal()

void * FMallocBinned2::ReallocExternal ( void * Ptr,
SIZE_T NewSize,
uint32 Alignment )
+ Here is the caller graph for this function:

◆ ReallocInline()

FORCEINLINE void * FMallocBinned2::ReallocInline ( void * Ptr,
SIZE_T NewSize,
uint32 Alignment )
inline

Definition at line 608 of file MallocBinned2.h.

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

◆ SetupTLSCachesOnCurrentThread()

virtual void FMallocBinned2::SetupTLSCachesOnCurrentThread ( )
overridevirtual

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

Reimplemented from FMalloc.

◆ Trim()

virtual void FMallocBinned2::Trim ( bool bTrimThreadCaches)
overridevirtual

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

Reimplemented from FMalloc.

◆ UpdateStats()

virtual void FMallocBinned2::UpdateStats ( )
overridevirtual

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 from FMalloc.

◆ UseSmallAlloc()

static FORCEINLINE bool FMallocBinned2::UseSmallAlloc ( SIZE_T Size,
uint32 Alignment )
inlinestatic

Definition at line 544 of file MallocBinned2.h.

+ Here is the caller graph for this function:

◆ ValidateHeap()

virtual bool FMallocBinned2::ValidateHeap ( )
overridevirtual

Validates the allocator's heap

Reimplemented from FMalloc.

Member Data Documentation

◆ Binned2TlsSlot

uint32 FMallocBinned2::Binned2TlsSlot
static

Definition at line 790 of file MallocBinned2.h.

◆ CachedOSPageAllocator

Definition at line 293 of file MallocBinned2.h.

◆ CurrentCanary

constexpr EBlockCanary FMallocBinned2::CurrentCanary = EBlockCanary::Value
staticconstexprprivate

Definition at line 286 of file MallocBinned2.h.

◆ HashBucketFreeList

PoolHashBucket* FMallocBinned2::HashBucketFreeList
private

Definition at line 280 of file MallocBinned2.h.

◆ HashBuckets

PoolHashBucket* FMallocBinned2::HashBuckets
private

Definition at line 279 of file MallocBinned2.h.

◆ MallocBinned2

FMallocBinned2* FMallocBinned2::MallocBinned2
static

Definition at line 789 of file MallocBinned2.h.

◆ MemSizeToIndex

uint8 FMallocBinned2::MemSizeToIndex[1+(BINNED2_MAX_SMALL_POOL_SIZE > > BINNED2_MINIMUM_ALIGNMENT_SHIFT)]
static

Definition at line 794 of file MallocBinned2.h.

◆ Mutex

FCriticalSection FMallocBinned2::Mutex
private

Definition at line 299 of file MallocBinned2.h.

◆ NumPoolsPerPage

uint64 FMallocBinned2::NumPoolsPerPage
private

Definition at line 281 of file MallocBinned2.h.

◆ OsAllocationGranularity

uint32 FMallocBinned2::OsAllocationGranularity
static

Definition at line 792 of file MallocBinned2.h.

◆ PageSize

uint32 FMallocBinned2::PageSize
static

Definition at line 791 of file MallocBinned2.h.

◆ PtrToPoolMapping

FPtrToPoolMapping FMallocBinned2::PtrToPoolMapping
private

Definition at line 274 of file MallocBinned2.h.

◆ SmallBlockSizesReversed

uint16 FMallocBinned2::SmallBlockSizesReversed[BINNED2_SMALL_POOL_COUNT]
static

Definition at line 788 of file MallocBinned2.h.

◆ SmallPoolTables

FPoolTable FMallocBinned2::SmallPoolTables[BINNED2_SMALL_POOL_COUNT]
private

Definition at line 277 of file MallocBinned2.h.


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