From 0fbb32403cb8e456da94633c69f3eb2af14ffc4a Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 23 Feb 2024 17:32:23 +0000 Subject: [PATCH] Add exponential behaviour to pool growth reallocation --- src/core/pool_func.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index a2cbb3af73..91b2095740 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -55,7 +55,7 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index) dbg_assert(index >= this->size); dbg_assert(index < Tmax_size); - size_t new_size = std::min(Tmax_size, Align(index + 1, std::max(64, Tgrowth_step))); + size_t new_size = std::min(Tmax_size, Align(std::max(index + 1, (this->size * 3) / 2), std::max(64, Tgrowth_step))); this->data = ReallocT(this->data, new_size); MemSetT(this->data + this->size, 0, new_size - this->size);