Construction of InternalMmapVector is often followed by a call to
reserve(), which may result in immediate reallocation of the memory
for the internal storage. This patch delays that allocation until
it is really needed.
Differential Revision: https://reviews.llvm.org/D71342
template<typename T>
class InternalMmapVector : public InternalMmapVectorNoCtor<T> {
public:
- InternalMmapVector() { InternalMmapVectorNoCtor<T>::Initialize(1); }
+ InternalMmapVector() { InternalMmapVectorNoCtor<T>::Initialize(0); }
explicit InternalMmapVector(uptr cnt) {
InternalMmapVectorNoCtor<T>::Initialize(cnt);
this->resize(cnt);
EXPECT_EQ((uptr)i, vector.size());
}
InternalMmapVector<uptr> empty_vector;
- CHECK_GT(empty_vector.capacity(), 0U);
+ CHECK_EQ(empty_vector.capacity(), 0U);
CHECK_EQ(0U, empty_vector.size());
}