From 697e0bb077e9cc4239c13e99e5564a1074bf435f Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Sat, 21 Jun 2025 11:23:05 +0200 Subject: [PATCH] Use `reserve` in `LocalVector::resize`, to restore expected growth behavior. --- core/templates/local_vector.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 50ad2cd0bb4..b45eeae4fc9 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -59,11 +59,7 @@ private: } count = p_size; } else if (p_size > count) { - if (unlikely(p_size > capacity)) { - capacity = tight ? p_size : nearest_power_of_2_templated(p_size); - data = (T *)memrealloc(data, capacity * sizeof(T)); - CRASH_COND_MSG(!data, "Out of memory"); - } + reserve(p_size); if constexpr (p_init) { memnew_arr_placement(data + count, p_size - count); } else {