You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mapleFU (via GitHub)" <gi...@apache.org> on 2023/05/27 06:14:47 UTC

[GitHub] [arrow] mapleFU commented on issue #35793: [C++] MemoryPool::Allocate returns an error when the user provides small values for alignment

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

   Seems that `velox` will force align the data:
   
   ```
     FOLLY_ALWAYS_INLINE int64_t sizeAlign(int64_t size) {
       const auto remainder = size % alignment_;
       return (remainder == 0) ? size : (size + alignment_ - remainder);
     }
   
   void* MemoryPoolImpl::allocate(int64_t size) {
     CHECK_AND_INC_MEM_OP_STATS(Allocs);
     const auto alignedSize = sizeAlign(size);
     reserve(alignedSize);
     void* buffer = allocator_->allocateBytes(alignedSize, alignment_);
     if (FOLLY_UNLIKELY(buffer == nullptr)) {
       release(alignedSize);
       VELOX_MEM_ALLOC_ERROR(fmt::format(
           "{} failed with {} bytes from {}", __FUNCTION__, size, toString()));
     }
     return buffer;
   }
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org