From da23ba4aa7827e95fbb0c4977d271c83e71c5fce Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sat, 19 Aug 2023 10:17:12 -0700 Subject: [PATCH] Add setting for bumpalloc pool size --- BeefLibs/corlib/src/BumpAllocator.bf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BeefLibs/corlib/src/BumpAllocator.bf b/BeefLibs/corlib/src/BumpAllocator.bf index 3b31db60..b7a60eb2 100644 --- a/BeefLibs/corlib/src/BumpAllocator.bf +++ b/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 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(new uint8[allocSize]* (?), allocSize); }