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

Method Reserve

cpp/src/arrow/memory_pool.cc:917–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

915 }
916
917 Status Reserve(const int64_t capacity) override {
918 if (capacity < 0) {
919 return Status::Invalid("Negative buffer capacity: ", capacity);
920 }
921 uint8_t* ptr = mutable_data();
922 if (!ptr || capacity > capacity_) {
923 ARROW_ASSIGN_OR_RAISE(int64_t new_capacity, RoundCapacity(capacity));
924 if (ptr) {
925 RETURN_NOT_OK(pool_->Reallocate(capacity_, new_capacity, alignment_, &ptr));
926 } else {
927 RETURN_NOT_OK(pool_->Allocate(new_capacity, alignment_, &ptr));
928 }
929 data_ = ptr;
930 capacity_ = new_capacity;
931 }
932 return Status::OK();
933 }
934
935 Status Resize(const int64_t new_size, bool shrink_to_fit = true) override {
936 if (ARROW_PREDICT_FALSE(new_size < 0)) {

Callers

nothing calls this directly

Calls 5

InvalidFunction · 0.70
mutable_dataFunction · 0.70
OKFunction · 0.70
ReallocateMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected