1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Add setting for bumpalloc pool size

This commit is contained in:
Brian Fiete 2023-08-19 10:17:12 -07:00
parent 57c50635a0
commit da23ba4aa7

View file

@ -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);
}