MCPcopy Create free account
hub / github.com/apache/arrow / Reserve

Method Reserve

cpp/src/arrow/io/memory.cc:113–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113Status BufferOutputStream::Reserve(int64_t nbytes) {
114 // Always overallocate by doubling. It seems that it is a better growth
115 // strategy, at least for memory_benchmark.cc.
116 // This may be because it helps match the allocator's allocation buckets
117 // more exactly. Or perhaps it hits a sweet spot in jemalloc.
118 int64_t new_capacity = std::max(kBufferMinimumSize, capacity_);
119 while (new_capacity < position_ + nbytes) {
120 new_capacity = new_capacity * 2;
121 }
122 if (new_capacity > capacity_) {
123 RETURN_NOT_OK(buffer_->Resize(new_capacity));
124 capacity_ = new_capacity;
125 mutable_data_ = buffer_->mutable_data();
126 }
127 return Status::OK();
128}
129
130// ----------------------------------------------------------------------
131// OutputStream that doesn't write anything

Callers 15

VisitMethod · 0.45
ExtendMethod · 0.45
ExtendMaskedMethod · 0.45
AppendIterableMethod · 0.45
InitBuildersMethod · 0.45
TESTFunction · 0.45
ArrayFromRangeFunction · 0.45
VisitFunction · 0.45
AddExtensionSetToMessageFunction · 0.45
VisitMethod · 0.45

Calls 3

OKFunction · 0.50
ResizeMethod · 0.45
mutable_dataMethod · 0.45

Tested by 3

TESTFunction · 0.36
ArrayFromRangeFunction · 0.36
TEST_FFunction · 0.36