xinyiZzz commented on code in PR #9250: URL: https://github.com/apache/incubator-doris/pull/9250#discussion_r859755912
########## be/src/vec/common/allocator.h: ########## @@ -146,8 +146,13 @@ class Allocator { std::to_string(old_size) + " to " + std::to_string(new_size) + ".", doris::TStatusCode::VEC_CANNOT_MREMAP); - /// No need for zero-fill, because mmap guarantees it. + + if constexpr (mmap_populate) + // MAP_POPULATE seems have no effect for mremap as for mmap, + // Zero-fill enlarged memory range explicitly to pre-fault the pages + if (new_size > old_size) + memset(reinterpret_cast<char*>(buf) + old_size, 0, new_size - old_size); Review Comment: Why manual zero-fill is needed here, CK's comment mentions that mmap is automatically zero-filled. The manual also seems to say so: https://linux.die.net/man/2/mmap -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org