mapleFU commented on code in PR #40774:
URL: https://github.com/apache/arrow/pull/40774#discussion_r1537991608
##########
cpp/src/arrow/memory_pool.cc:
##########
@@ -498,6 +532,46 @@ class BaseMemoryPoolImpl : public MemoryPool {
return Status::OK();
}
+ Status ReallocateNoCopy(int64_t old_size, int64_t new_size, int64_t
alignment,
+ uint8_t** ptr) override {
+ if (new_size == old_size) {
+ return Status::OK();
+ }
+ if (old_size == 0 || new_size == 0) {
+ return Reallocate(old_size, new_size, alignment, ptr);
+ }
+ if (new_size < 0) {
+ return Status::Invalid("negative realloc size");
+ }
+ if (static_cast<uint64_t>(new_size) >= std::numeric_limits<size_t>::max())
{
+ return Status::OutOfMemory("realloc overflows size_t");
+ }
+ // First try resizing in place
+ if (!Allocator::ResizeInPlace(old_size, new_size, *ptr)) {
Review Comment:
So this would do allocate best-effort?
##########
cpp/src/arrow/memory_pool.cc:
##########
@@ -498,6 +532,46 @@ class BaseMemoryPoolImpl : public MemoryPool {
return Status::OK();
}
+ Status ReallocateNoCopy(int64_t old_size, int64_t new_size, int64_t
alignment,
+ uint8_t** ptr) override {
+ if (new_size == old_size) {
+ return Status::OK();
+ }
+ if (old_size == 0 || new_size == 0) {
+ return Reallocate(old_size, new_size, alignment, ptr);
+ }
+ if (new_size < 0) {
+ return Status::Invalid("negative realloc size");
+ }
+ if (static_cast<uint64_t>(new_size) >= std::numeric_limits<size_t>::max())
{
+ return Status::OutOfMemory("realloc overflows size_t");
+ }
+ // First try resizing in place
+ if (!Allocator::ResizeInPlace(old_size, new_size, *ptr)) {
Review Comment:
So this would do re-allocate local best-effort?
--
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]