pitrou commented on a change in pull request #12116: URL: https://github.com/apache/arrow/pull/12116#discussion_r806108396
########## File path: cpp/src/arrow/memory_pool.cc ########## @@ -603,14 +643,109 @@ class BaseMemoryPoolImpl : public MemoryPool { stats_.UpdateAllocatedBytes(-size); } - void ReleaseUnused() override { Allocator::ReleaseUnused(); } + protected: + virtual Status AllocateImmutableZeros(int64_t size, uint8_t** out) { +#ifdef USE_MMAP_FOR_IMMUTABLE_ZEROS + if (size > 0) { + *out = static_cast<uint8_t*>(mmap( + nullptr, size, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0)); Review comment: Ah, you're right, we don't know that the allocator returned us zero-allocated memory, unfortunately. (note that both jemalloc and mimalloc have zero-initializing allocation APIs, so we could use those) -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org