diff --git a/adb/types.h b/adb/types.h index 0c71c3a2a..0090c9878 100644 --- a/adb/types.h +++ b/adb/types.h @@ -108,7 +108,10 @@ struct Block { CHECK_EQ(0ULL, capacity_); CHECK_EQ(0ULL, size_); if (size != 0) { - data_ = std::make_unique(size); + // This isn't std::make_unique because that's equivalent to `new char[size]()`, which + // value-initializes the array instead of leaving it uninitialized. As an optimization, + // call new without parentheses to avoid this costly initialization. + data_.reset(new char[size]); capacity_ = size; size_ = size; }