MCPcopy Create free account
hub / github.com/bytedance/bolt / prepareForReuse

Method prepareForReuse

bolt/vector/FlatVector.cpp:121–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120template <>
121void FlatVector<StringView>::prepareForReuse() {
122 BaseVector::prepareForReuse();
123
124 // Check values buffer. Keep the buffer if singly-referenced and mutable.
125 // Reset otherwise.
126 if (values_ && !values_->isMutable()) {
127 values_ = nullptr;
128 rawValues_ = nullptr;
129 }
130
131 keepAtMostOneStringBuffer();
132
133 // Clear the StringViews to avoid referencing freed memory.
134 if (rawValues_) {
135 for (auto i = 0; i < BaseVector::length_; ++i) {
136 rawValues_[i] = StringView();
137 }
138 }
139
140 // Reset string stats since the vector is being reused with new data.
141 stringStats_.reset();
142}
143
144template <>
145void FlatVector<StringView>::set(vector_size_t idx, StringView value) {

Callers

nothing calls this directly

Calls 3

isMutableMethod · 0.80
StringViewClass · 0.50
resetMethod · 0.45

Tested by

no test coverage detected