Add exponential behaviour to pool growth reallocation

This commit is contained in:
Jonathan G Rennison 2024-02-23 17:32:23 +00:00
parent fcad801685
commit 0fbb32403c

View File

@ -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<uint>(64, Tgrowth_step)));
size_t new_size = std::min<size_t>(Tmax_size, Align(std::max<uint>(index + 1, (this->size * 3) / 2), std::max<uint>(64, Tgrowth_step)));
this->data = ReallocT(this->data, new_size);
MemSetT(this->data + this->size, 0, new_size - this->size);