5#include "Containers/Array.h"
7#include "HAL/PlatformMemory.h"
8#include "Templates/Function.h"
12#define BINNEDCOMMON_MAX_LISTED_SMALL_POOL_SIZE 28672
13#define BINNEDCOMMON_NUM_LISTED_SMALL_POOLS 49
15#if !defined(BINNEDCOMMON_USE_SEPARATE_VM_PER_POOL)
17 #define BINNEDCOMMON_USE_SEPARATE_VM_PER_POOL (1
)
19 #define BINNEDCOMMON_USE_SEPARATE_VM_PER_POOL (0
)
28 uint32 DesiredCapacity;
30 uint32 OffsetOfLastRow;
31 uint32 AllocationSize;
39 static uint32 GetMemoryRequirements(uint32 DesiredCapacity);
40 void FBitTreeInit(uint32 InDesiredCapacity,
void * Memory, uint32 MemorySize,
bool InitialValue);
42 bool IsAllocated(uint32 Index)
const;
43 void AllocBit(uint32 Index);
44 uint32 NextAllocBit()
const;
45 uint32 NextAllocBit(uint32 StartIndex)
const;
46 void FreeBit(uint32 Index);
47 uint32 CountOnes(uint32 UpTo)
const;
53 uint16 BlocksPerBlockOfBlocks;
54 uint8 PagesPlatformForBlockOfBlocks;
60 FSizeTableEntry(uint32 InBlockSize, uint64 PlatformPageSize, uint8 Pages4k, uint32 BasePageSize, uint32 MinimumAlignment);
62 bool operator<(
const FSizeTableEntry& Other)
const
64 return BlockSize < Other.BlockSize;
66 static uint8 FillSizeTable(uint64 PlatformPageSize, FSizeTableEntry* SizeTable, uint32 BasePageSize, uint32 MinimumAlignment, uint32 MaxSize, uint32 SizeIncrement);
72 uint64 AddressLimit = 1024 * 1024 * 1024;
73 uint32 BasePageSize = 4096;
74 uint32 AllocationGranularity = 4096;
75 uint32 MaxSizePerBundle = 8192;
76 uint32 MaxStandardPoolSize = 128 * 1024;
77 uint16 MaxBlocksPerBundle = 64;
78 uint8 MaxMemoryPerBlockSizeShift = 29;
79 uint8 EmptyCacheAllocExtra = 32;
80 uint8 MaxGlobalBundles = 32;
81 uint8 MinimumAlignmentShift = 4;
83 bool bUseSeparateVMPerPool = !!(BINNEDCOMMON_USE_SEPARATE_VM_PER_POOL);
84 bool bPerThreadCaches =
true;
85 bool bUseStandardSmallPoolSizes =
true;
86 bool bAttemptToAlignSmallBocks =
true;
87 TArray<uint32> AdditionalBlockSizes;
94 TFunction<
void*(SIZE_T, SIZE_T, SIZE_T&, uint32&)> LargeBlockAlloc;
95 TFunction<
void(
void*, uint32)> LargeBlockFree;
99 uint64 MaxMemoryPerBlockSize;
101 uint32 MinimumAlignment;
102 uint32 MaximumAlignmentForSmallBlock;