1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Use reserve in LocalVector::resize, to restore expected growth behavior.

This commit is contained in:
Lukas Tenbrink
2025-06-21 11:23:05 +02:00
parent 5abed52fd9
commit 697e0bb077

View File

@@ -59,11 +59,7 @@ private:
} }
count = p_size; count = p_size;
} else if (p_size > count) { } else if (p_size > count) {
if (unlikely(p_size > capacity)) { reserve(p_size);
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");
}
if constexpr (p_init) { if constexpr (p_init) {
memnew_arr_placement(data + count, p_size - count); memnew_arr_placement(data + count, p_size - count);
} else { } else {