mapleFU commented on issue #39377:
URL: https://github.com/apache/arrow/issues/39377#issuecomment-1869881645

   ```c++
     Status Resize(const int64_t new_size, bool shrink_to_fit = true) override {
       if (ARROW_PREDICT_FALSE(new_size < 0)) {
         return Status::Invalid("Negative buffer resize: ", new_size);
       }
       uint8_t* ptr = mutable_data();
       if (ptr && shrink_to_fit && new_size <= size_) {
         // Buffer is non-null and is not growing, so shrink to the requested 
size without
         // excess space.
         int64_t new_capacity = bit_util::RoundUpToMultipleOf64(new_size);
         if (capacity_ != new_capacity) {
           // Buffer hasn't got yet the requested size.
           RETURN_NOT_OK(pool_->Reallocate(capacity_, new_capacity, alignment_, 
&ptr));
           data_ = ptr;
           capacity_ = new_capacity;
         }
       } else {
         RETURN_NOT_OK(Reserve(new_size));
       }
       size_ = new_size;
   
       return Status::OK();
     }
   ```
   
   @felipecrv `Resize` has a `shrink_to_fit` option, wouldn't it free by 
`Reallocate`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to