7#if PLATFORM_HAS_FPlatformVirtualMemoryBlock
22#ifndef UE_MB3_USE_CACHED_PAGE_ALLOCATOR_FOR_LARGE_ALLOCS
23# define UE_MB3_USE_CACHED_PAGE_ALLOCATOR_FOR_LARGE_ALLOCS (0)
27# define UE_MB3_MAX_MEMORY_PER_POOL_SIZE_MB 512
28#elif !defined(UE_MB3_MAX_MEMORY_PER_POOL_SIZE_MB)
29# define UE_MB3_MAX_MEMORY_PER_POOL_SIZE_MB 1024
32#if defined(USE_512MB_MAX_MEMORY_PER_BLOCK_SIZE)
33# warning "USE_512MB_MAX_MEMORY_PER_BLOCK_SIZE is deprecated. Please use UE_MB3_MAX_MEMORY_PER_POOL_SIZE_MB=%MB% instead"
36#define UE_MB3_BASE_PAGE_SIZE 4096
39#ifndef UE_MB3_MAX_SMALL_POOL_SIZE
40# if UE_MB3_USE_CACHED_PAGE_ALLOCATOR_FOR_LARGE_ALLOCS
41# define UE_MB3_MAX_SMALL_POOL_SIZE (UE_MBC_MAX_LISTED_SMALL_POOL_SIZE)
43# define UE_MB3_MAX_SMALL_POOL_SIZE (128 * 1024)
46#define UE_MB3_SMALL_POOL_COUNT (UE_MBC_NUM_LISTED_SMALL_POOLS + (UE_MB3_MAX_SMALL_POOL_SIZE - UE_MBC_MAX_LISTED_SMALL_POOL_SIZE) / UE_MB3_BASE_PAGE_SIZE)
48#define UE_MB3_MAX_MEMORY_PER_POOL_SIZE_SHIFT (FMath::CountTrailingZeros(FMath::RoundUpToPowerOfTwo(UE_MB3_MAX_MEMORY_PER_POOL_SIZE_MB * 1024 * 1024)))
50#define UE_MB3_MAX_MEMORY_PER_POOL_SIZE (1ull << UE_MB3_MAX_MEMORY_PER_POOL_SIZE_SHIFT)
53#if !defined(BINNED3_USE_SEPARATE_VM_PER_POOL)
55# define BINNED3_USE_SEPARATE_VM_PER_POOL (1)
57# define BINNED3_USE_SEPARATE_VM_PER_POOL (0)
61#define UE_MB3_ALLOCATOR_STATS UE_MBC_ALLOCATOR_STATS
63#if UE_MB3_ALLOCATOR_STATS
64# define UE_M3_ALLOCATOR_PER_BIN_STATS !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
66# define UE_M3_ALLOCATOR_PER_BIN_STATS 0
97 enum class ECanary :
uint32
105 void CheckCanary(ECanary
ShouldBe)
const;
108 uint32 GetOSRequestedBytes()
const;
112 uint32 GetOsAllocatedBytes()
const
124 uint32 VMSizeDivVirtualSizeAlignment;
138 uint32 NumMemoryPagesPerBlock;
148#if UE_MB3_ALLOCATOR_STATS
156#if UE_M3_ALLOCATOR_PER_BIN_STATS
188#if UE_MB3_USE_CACHED_PAGE_ALLOCATOR_FOR_LARGE_ALLOCS
192#if !BINNED3_USE_SEPARATE_VM_PER_POOL
202# if UE_MB3_ALLOCATOR_STATS
270 FORCEINLINE bool IsOSAllocation(
const void* Ptr)
const
320 inline bool GetSmallAllocationSize(
void* Ptr,
SIZE_T&
SizeOut)
const
325 SizeOut = PoolIndexToBinSize(PoolIndex);
334 if (GetSmallAllocationSize(Ptr,
SizeOut))
357 void FreeExternal(
void* Ptr,
uint64 PoolIndex);
364#if !BINNED3_USE_SEPARATE_VM_PER_POOL
374 static uint8 MemSizeToPoolIndex[SIZE_TO_POOL_INDEX_NUM];
381 void FreeBundles(FBundleNode* Bundles,
uint32 PoolIndex);
386 void FlushCurrentThreadCacheInternal(
bool bNewEpochOnly =
false);
388 static void* AllocateMetaDataMemory(
SIZE_T Size);
389 static void FreeMetaDataMemory(
void *Ptr,
SIZE_T Size);
394#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_7
@ Unassigned
Definition AppleControllerInterface.h:15
#define check(expr)
Definition AssertionMacros.h:314
#define UE_AUTORTFM_NOAUTORTFM
Definition AutoRTFMDefines.h:113
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UE_MBC_BIN_SIZE_SHIFT
Definition MallocBinnedCommon.h:49
uint32 Size
Definition VulkanMemory.cpp:4034
int BlockIndex
Definition binka_ue_decode_test.cpp:38
Definition MallocBinnedCommon.h:120
virtual const TCHAR * GetDescriptiveName()
Definition MemoryBase.h:248
virtual bool GetAllocationSize(void *Original, SIZE_T &SizeOut)
Definition MemoryBase.h:158
virtual void * Malloc(SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
virtual bool ValidateHeap()
Definition MemoryBase.h:238
virtual bool IsInternallyThreadSafe() const
Definition MemoryBase.h:230
virtual void DumpAllocatorStats(class FOutputDevice &Ar)
Definition MemoryBase.h:221
virtual void Trim(bool bTrimThreadCaches)
Definition MemoryBase.h:166
virtual void * Realloc(void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
virtual CORE_API void UpdateStats()
Definition MemoryBase.cpp:72
virtual SIZE_T QuantizeSize(SIZE_T Count, uint32 Alignment)
Definition MemoryBase.h:146
Definition OutputDevice.h:133
Definition MallocBinnedCommon.h:452
SIZE_T QuantizeSizeCommon(SIZE_T Count, uint32 Alignment, const AllocType &Alloc) const
Definition MallocBinnedCommon.h:836
void UpdateStatsCommon(const AllocType &Alloc)
Definition MallocBinnedCommon.h:956
bool GetAllocationSizeExternal(void *Ptr, SIZE_T &SizeOut)
Definition MallocBinnedCommon.h:909
UE::FRecursiveMutex Mutex
Definition MeshPaintVirtualTexture.cpp:164
Definition OverriddenPropertySet.cpp:45
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
FPThreadsRecursiveMutex FPlatformRecursiveMutex
Definition AndroidPlatformMutex.h:12