Skip to content

Commit

Permalink
21
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyiZzz committed Apr 15, 2024
1 parent 894897b commit 55b0d1a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion be/src/vec/common/pod_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,34 @@ class PODArrayBase : private boost::noncopyable,

template <typename... TAllocatorParams>
void resize(size_t n, TAllocatorParams&&... allocator_params) {
size_t old_capacity = capacity();
size_t old_allocated_bytes = allocated_bytes();
size_t old_alloc_bytes = alloc_bytes;
size_t old_pad_right = pad_right;
size_t old_pad_left = pad_left;
size_t old_sub = c_end_of_storage - c_start;
reserve(n, std::forward<TAllocatorParams>(allocator_params)...);
size_t two_capacity = capacity();
size_t two_allocated_bytes = allocated_bytes();
size_t two_alloc_bytes = alloc_bytes;
size_t two_pad_right = pad_right;
size_t two_pad_left = pad_left;
size_t two_sub = c_end_of_storage - c_start;
resize_assume_reserved(n);
DCHECK(alloc_bytes == allocated_bytes())
<< ", realloc1 alloc_bytes: " << alloc_bytes
<< ", allocated_bytes(): " << allocated_bytes() << ", pad_right: " << pad_right
<< ", pad_left: " << pad_left
<< ", c_end_of_storage - start: " << c_end_of_storage - c_start;
<< ", c_end_of_storage - start: " << c_end_of_storage - c_start
<< ", capacity: " << capacity() << ", n: " << n
<< ", old_capacity: " << old_capacity
<< ", old_allocated_bytes: " << old_allocated_bytes
<< ", old_alloc_bytes: " << old_alloc_bytes << ", old_pad_right: " << old_pad_right
<< ", old_pad_left: " << old_pad_left << ", old_sub: " << old_sub
<< ", two_capacity: " << two_capacity
<< ", two_allocated_bytes: " << two_allocated_bytes
<< ", two_alloc_bytes: " << two_alloc_bytes << ", two_pad_right: " << two_pad_right
<< ", two_pad_left: " << two_pad_left << ", two_sub: " << two_sub;
}

void resize_assume_reserved(const size_t n) { c_end = c_start + byte_size(n); }
Expand Down

0 comments on commit 55b0d1a

Please sign in to comment.