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

Method Reserve

cpp/src/arrow/memory_pool.cc:922–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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