![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <MemoryBase.h>
Inheritance diagram for FMalloc:Static Public Attributes | |
| static CORE_API TAtomic< uint64 > | MaxSingleAlloc |
Friends | |
| struct | FCurrentFrameCalls |
Additional Inherited Members | |
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) |
The global memory allocator's interface.
Clears the TLS caches on the current thread and disables any future caching.
Reimplemented in FMallocPurgatoryProxy, TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >, TMallocBinnedCommon< FMallocBinned2, UE_MB2_SMALL_POOL_COUNT, UE_MB2_MAX_SMALL_POOL_SIZE >, FMallocCallstackHandler, and FMallocPoisonProxy.
|
inlinevirtual |
Dumps current allocator stats to the log.
Reimplemented in FMallocPurgatoryProxy, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, and FMallocDebug.
Free
Implemented in FGenericPlatformMallocCrash, FGenericStackBasedMallocCrash, FMallocDebug, FMallocCallstackHandler, FTraceMalloc, FMallocPurgatoryProxy, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, FIOSMallocCrashHandler, FMacMallocZone, and FMacMallocCrashHandler.
If possible determine the size of the memory allocated at the given address
| 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 |
Reimplemented in FMallocPurgatoryProxy, FGenericPlatformMallocCrash, FMallocAnsi, FMallocBinned, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, FIOSMallocCrashHandler, FMacMallocZone, FMacMallocCrashHandler, and FMallocBinned2.
|
virtual |
Writes allocator stats from the last update into the specified destination.
Reimplemented in FMallocPurgatoryProxy, FMallocBinned, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >, and TMallocBinnedCommon< FMallocBinned2, UE_MB2_SMALL_POOL_COUNT, UE_MB2_MAX_SMALL_POOL_SIZE >.
Gets descriptive name for logging purposes.
Reimplemented in FMallocPurgatoryProxy, FGenericPlatformMallocCrash, FGenericStackBasedMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, FIOSMallocCrashHandler, FMacMallocZone, and FMacMallocCrashHandler.
Returns the amount of free memory cached by the allocator that can be returned to the system in case of a memory shortage
Reimplemented in FMallocBinned2.
Returns the amount of total free memory cached by the allocator. This includes memory that can be returned to the system in case of a memory shortage, see GetImmediatelyFreeableCachedMemorySize() as well as any memory that can't be returned back to the kernel, but can be used to satisfy some of the allocation requirements.
Reimplemented in FMallocBinned2.
|
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 FMallocPurgatoryProxy, FMallocBinned, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.
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, FMallocThreadSafeProxy, FIOSMallocZone, and FMacMallocZone.
|
pure virtual |
Malloc
Implemented in FTraceMalloc, FMallocCallstackHandler, FMallocPurgatoryProxy, FGenericPlatformMallocCrash, FGenericStackBasedMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocDebug, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, FIOSMallocCrashHandler, FMacMallocZone, and FMacMallocCrashHandler.
|
virtual |
Malloc zeroed memory
Reimplemented in FMallocPoisonProxy.
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 in FMallocCallstackHandler, FMallocPurgatoryProxy, TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >, TMallocBinnedCommon< FMallocBinned2, UE_MB2_SMALL_POOL_COUNT, UE_MB2_MAX_SMALL_POOL_SIZE >, and FMallocPoisonProxy.
Mark TLS caches for the current thread as used. Thread has woken up to do some processing and needs its TLS caches back.
Reimplemented in FMallocPurgatoryProxy, TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >, TMallocBinnedCommon< FMallocBinned2, UE_MB2_SMALL_POOL_COUNT, UE_MB2_MAX_SMALL_POOL_SIZE >, FMallocCallstackHandler, and FMallocPoisonProxy.
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 FMallocPurgatoryProxy, FMallocBinned2, FMallocBinnedCommonBase, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, and FTraceMalloc.
Notifies the malloc implementation that the process has forked so we can try and avoid dirtying pre-fork pages.
Reimplemented in FMallocPurgatoryProxy, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, and FTraceMalloc.
Notifies the malloc implementation that the process is about to fork. May be used to trim caches etc.
Reimplemented in FMallocPurgatoryProxy, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, FMallocThreadSafeProxy, and FTraceMalloc.
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 FMallocPurgatoryProxy, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, and FMallocPoisonProxy.
|
pure virtual |
Realloc
Implemented in FMallocDebug, FTraceMalloc, FMallocCallstackHandler, FMallocPurgatoryProxy, FGenericPlatformMallocCrash, FGenericStackBasedMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, FIOSMallocCrashHandler, FMacMallocZone, and FMacMallocCrashHandler.
Set up TLS caches on the current thread. These are the threads that we can trim.
Reimplemented in FMallocPurgatoryProxy, TMallocBinnedCommon< AllocType, NumSmallPools, MaxSmallPoolSize >, TMallocBinnedCommon< FMallocBinned2, UE_MB2_SMALL_POOL_COUNT, UE_MB2_MAX_SMALL_POOL_SIZE >, FMallocCallstackHandler, and FMallocPoisonProxy.
Releases as much memory as possible. Must be called from the main thread.
Reimplemented in FMallocPurgatoryProxy, FMallocBinned2, FMallocCallstackHandler, FMallocPoisonProxy, and FMallocThreadSafeProxy.
|
virtual |
TryMalloc - like Malloc(), but may return a nullptr result if the allocation request cannot be satisfied.
Reimplemented in FMallocAnsi.
|
virtual |
TryMalloc - like MallocZeroed(), but may return a nullptr result if the allocation request cannot be satisfied.
|
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.
|
virtual |
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.
Validates the allocator's heap
Reimplemented in FMallocPurgatoryProxy, FGenericPlatformMallocCrash, FMallocAnsi, FMallocBinned, FMallocBinned2, FMallocCallstackHandler, FMallocDebug, FMallocPoisonProxy, FMallocThreadSafeProxy, FIOSMallocZone, and FMacMallocZone.
|
friend |
Limits the maximum single allocation, to this many bytes, for debugging