Skip to content

Commit 697e0bb

Browse files
committed
Use reserve in LocalVector::resize, to restore expected growth behavior.
1 parent 5abed52 commit 697e0bb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

core/templates/local_vector.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@ class LocalVector {
5959
}
6060
count = p_size;
6161
} else if (p_size > count) {
62-
if (unlikely(p_size > capacity)) {
63-
capacity = tight ? p_size : nearest_power_of_2_templated(p_size);
64-
data = (T *)memrealloc(data, capacity * sizeof(T));
65-
CRASH_COND_MSG(!data, "Out of memory");
66-
}
62+
reserve(p_size);
6763
if constexpr (p_init) {
6864
memnew_arr_placement(data + count, p_size - count);
6965
} else {

0 commit comments

Comments
 (0)