UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize > Class Template Reference

#include <MallocBinnedCommon.h>

+ Inheritance diagram for TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >:

Classes

struct  FPerThreadFreeBlockLists
 
struct  Internal
 

Public Member Functions

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

Protected Member Functions

virtual void SetupTLSCachesOnCurrentThread () override
 
virtual void ClearAndDisableTLSCachesOnCurrentThread () override
 
virtual void MarkTLSCachesAsUsedOnCurrentThread () override
 
virtual void MarkTLSCachesAsUnusedOnCurrentThread () override
 
SIZE_T QuantizeSizeCommon (SIZE_T Count, uint32 Alignment, const AllocType &Alloc) const
 
uint32 BoundSizeToPoolIndex (SIZE_T Size, const uint8(&MemSizeToPoolIndex)[SIZE_TO_POOL_INDEX_NUM]) const
 
FORCENOINLINE bool PromoteToLargerBin (SIZE_T &Size, uint32 &Alignment, const AllocType &Alloc) const
 
bool GetAllocationSizeExternal (void *Ptr, SIZE_T &SizeOut)
 
int64 GetTotalAllocatedSmallPoolMemory () const
 
void UpdateStatsCommon (const AllocType &Alloc)
 
void AllocateHashBuckets ()
 
- Protected Member Functions inherited from FMallocBinnedCommonBase
void GetAllocatorStatsInternal (FGenericMemoryStats &OutStats, int64 TotalAllocatedSmallPoolMemory)
 
void UnrecognizedPointerFatalError (void *Ptr)
 
void LogLargeAllocation (SIZE_T Size) const
 
- Protected Member Functions inherited from FExec
virtual bool Exec_Runtime (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 
virtual bool Exec_Dev (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 
virtual bool Exec_Editor (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
 

Static Protected Member Functions

static UE::FPlatformRecursiveMutexGetFreeBlockListsRegistrationMutex ()
 
static TArray< FPerThreadFreeBlockLists * > & GetRegisteredFreeBlockLists ()
 
- Static Protected Member Functions inherited from FMallocBinnedCommonBase
static void OutOfMemory (uint64 Size, uint32 Alignment=0)
 

Static Protected Attributes

static constexpr int SIZE_TO_POOL_INDEX_NUM = 1 + (MAX_SMALL_POOL_SIZE >> UE_MBC_BIN_SIZE_SHIFT)
 
- Static Protected Attributes inherited from FMallocBinnedCommonBase
static uint32 OsAllocationGranularity = 0
 
static CORE_API uint32 BinnedTlsSlot = FPlatformTLS::InvalidTlsSlot
 
static std::atomic< int64TLSMemory
 
static std::atomic< int64ConsolidatedMemory
 
static std::atomic< int64AllocatedSmallPoolMemory
 
static std::atomic< int64AllocatedOSSmallPoolMemory
 
static std::atomic< int64AllocatedLargePoolMemory
 
static std::atomic< int64AllocatedLargePoolMemoryWAlignment
 
static int64 PoolInfoMemory
 
static int64 HashMemory
 

Friends

class FMallocBinnedCommonUtils
 

Additional Inherited Members

- Static Public Attributes inherited from FMalloc
static CORE_API TAtomic< uint64MaxSingleAlloc
 
- Protected Attributes inherited from FMallocBinnedCommonBase
FPtrToPoolMapping PtrToPoolMapping
 
uint64 NumPoolsPerPage
 
UE::FPlatformRecursiveMutex ExternalAllocMutex
 
std::atomic< uint64MemoryTrimEpoch { 0 }
 

Member Function Documentation

◆ AllocateHashBuckets()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::AllocateHashBuckets ( )
inlineprotected

◆ BoundSizeToPoolIndex()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
uint32 TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::BoundSizeToPoolIndex ( SIZE_T  Size,
const uint8(&)  MemSizeToPoolIndex[SIZE_TO_POOL_INDEX_NUM] 
) const
inlineprotected

◆ ClearAndDisableTLSCachesOnCurrentThread()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
virtual void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::ClearAndDisableTLSCachesOnCurrentThread ( )
inlineoverrideprotectedvirtual

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

Reimplemented from FMalloc.

◆ GetAllocationSizeExternal()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
bool TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::GetAllocationSizeExternal ( void Ptr,
SIZE_T SizeOut 
)
inlineprotected

◆ GetAllocatorStats()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
virtual void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::GetAllocatorStats ( FGenericMemoryStats out_Stats)
inlineoverridevirtual

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

Reimplemented from FMalloc.

◆ GetFreeBlockListsRegistrationMutex()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
static UE::FPlatformRecursiveMutex & TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::GetFreeBlockListsRegistrationMutex ( )
inlinestaticprotected

◆ GetRegisteredFreeBlockLists()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
static TArray< FPerThreadFreeBlockLists * > & TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::GetRegisteredFreeBlockLists ( )
inlinestaticprotected

◆ GetTotalAllocatedSmallPoolMemory()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
int64 TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::GetTotalAllocatedSmallPoolMemory ( ) const
inlineprotected

◆ MarkTLSCachesAsUnusedOnCurrentThread()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
virtual void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::MarkTLSCachesAsUnusedOnCurrentThread ( )
inlineoverrideprotectedvirtual

Mark TLS caches for current thread as unused. Typically before going to sleep. These are the threads that we can trim without waking them up.

Reimplemented from FMalloc.

◆ MarkTLSCachesAsUsedOnCurrentThread()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
virtual void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::MarkTLSCachesAsUsedOnCurrentThread ( )
inlineoverrideprotectedvirtual

Mark TLS caches for the current thread as used. Thread has woken up to do some processing and needs its TLS caches back.

Reimplemented from FMalloc.

◆ PromoteToLargerBin()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
FORCENOINLINE bool TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::PromoteToLargerBin ( SIZE_T Size,
uint32 Alignment,
const AllocType Alloc 
) const
inlineprotected

◆ QuantizeSizeCommon()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
SIZE_T TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::QuantizeSizeCommon ( SIZE_T  Count,
uint32  Alignment,
const AllocType Alloc 
) const
inlineprotected

◆ SetupTLSCachesOnCurrentThread()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
virtual void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::SetupTLSCachesOnCurrentThread ( )
inlineoverrideprotectedvirtual

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

Reimplemented from FMalloc.

◆ UpdateStatsCommon()

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
void TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::UpdateStatsCommon ( const AllocType Alloc)
inlineprotected

Friends And Related Symbol Documentation

◆ FMallocBinnedCommonUtils

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
friend class FMallocBinnedCommonUtils
friend

Member Data Documentation

◆ SIZE_TO_POOL_INDEX_NUM

template<class AllocType , int NumSmallPools, int MaxSmallPoolSize>
constexpr int TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >::SIZE_TO_POOL_INDEX_NUM = 1 + (MAX_SMALL_POOL_SIZE >> UE_MBC_BIN_SIZE_SHIFT)
staticconstexprprotected

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