2
0
Эх сурвалжийг харах

Add setting for bumpalloc pool size

Brian Fiete 2 жил өмнө
parent
commit
da23ba4aa7

+ 4 - 1
BeefLibs/corlib/src/BumpAllocator.bf

@@ -29,6 +29,9 @@ namespace System
 		uint8* mCurPtr;
 		uint8* mCurEnd;
 
+		public int PoolSizeMin = 4*1024;
+		public int PoolSizeMax = 64*1024;
+
 #if BF_ENABLE_REALTIME_LEAK_CHECK
 		// We will either contain only data that needs to be marked or not, based on the first
 		//  data allocated. The paired allocator will contain the other type of data
@@ -94,7 +97,7 @@ namespace System
 		protected virtual Span<uint8> AllocPool()
 		{
 			int poolSize = (mPools != null) ? mPools.Count : 0;
-			int allocSize = Math.Clamp((int)Math.Pow(poolSize, 1.5) * 4*1024, 4*1024, 64*1024);
+			int allocSize = Math.Clamp((int)Math.Pow(poolSize, 1.5) * PoolSizeMin, PoolSizeMin, PoolSizeMax);
 			return Span<uint8>(new uint8[allocSize]* (?), allocSize);
 		}