diff --git a/src/trace_processor/core/util/flex_vector.h b/src/trace_processor/core/util/flex_vector.h index 9c578ebc90..4014fe1880 100644 --- a/src/trace_processor/core/util/flex_vector.h +++ b/src/trace_processor/core/util/flex_vector.h @@ -188,6 +188,9 @@ class FlexVector { // Shrinks the memory allocated by the vector to be as small as possible while // still maintaining the invariants of the class. void shrink_to_fit() { + if (base::AlignUp(size_, kCapacityMultiple) == capacity()) { + return; + } if (size_ == 0) { slab_ = Slab::Alloc(0); } else {