yiguolei commented on code in PR #37257:
URL: https://github.com/apache/doris/pull/37257#discussion_r1689170208
##########
be/src/vec/common/allocator.h:
##########
@@ -112,32 +232,42 @@ class Allocator {
release_memory(size);
throw_bad_alloc(fmt::format("Allocator: Cannot mmap {}.",
size));
}
+ if constexpr (MemoryAllocator::need_record_actual_size()) {
+ record_size = MemoryAllocator::allocated_size(buf);
+ }
/// No need for zero-fill, because mmap guarantees it.
} else {
if (alignment <= MALLOC_MIN_ALIGNMENT) {
if constexpr (clear_memory)
- buf = ::calloc(size, 1);
+ buf = MemoryAllocator::calloc(size, 1);
else
- buf = ::malloc(size);
+ buf = MemoryAllocator::malloc(size);
if (nullptr == buf) {
release_memory(size);
throw_bad_alloc(fmt::format("Allocator: Cannot malloc
{}.", size));
}
+ if constexpr (MemoryAllocator::need_record_actual_size()) {
+ record_size = MemoryAllocator::allocated_size(buf);
+ }
} else {
buf = nullptr;
- int res = posix_memalign(&buf, alignment, size);
+ int res = MemoryAllocator::posix_memalign(&buf, alignment,
size);
if (0 != res) {
release_memory(size);
throw_bad_alloc(
fmt::format("Cannot allocate memory
(posix_memalign) {}.", size));
}
-
- if constexpr (clear_memory) memset(buf, 0, size);
Review Comment:
why delete clear memory??
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]