You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/10/18 13:11:36 UTC
[doris] branch master updated: [fix](mem) failure of allocating memory (#13414)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 971eb9172f [fix](mem) failure of allocating memory (#13414)
971eb9172f is described below
commit 971eb9172f3e925c0b46ec1ffd1a9037a1b49801
Author: Jerry Hu <mr...@gmail.com>
AuthorDate: Tue Oct 18 21:11:30 2022 +0800
[fix](mem) failure of allocating memory (#13414)
When the target size to allocate is 8164, MemPool will return nullptr.
---
be/src/runtime/mem_pool.h | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/be/src/runtime/mem_pool.h b/be/src/runtime/mem_pool.h
index a1db3e6c5d..d11952dd50 100644
--- a/be/src/runtime/mem_pool.h
+++ b/be/src/runtime/mem_pool.h
@@ -231,16 +231,17 @@ private:
// I refers to https://github.com/mcgov/asan_alignment_example.
ChunkInfo& info = chunks_[current_chunk_idx_];
- int64_t aligned_allocated_bytes = BitUtil::RoundUpToMultiplyOfFactor(
- info.allocated_bytes + DEFAULT_PADDING_SIZE, alignment);
- if (aligned_allocated_bytes + size + DEFAULT_PADDING_SIZE <= info.chunk.size) {
+ int64_t aligned_allocated_bytes =
+ BitUtil::RoundUpToMultiplyOfFactor(info.allocated_bytes, alignment);
+ auto size_with_padding = size + DEFAULT_PADDING_SIZE;
+ if (aligned_allocated_bytes + size_with_padding <= info.chunk.size) {
// Ensure the requested alignment is respected.
int64_t padding = aligned_allocated_bytes - info.allocated_bytes;
uint8_t* result = info.chunk.data + aligned_allocated_bytes;
- ASAN_UNPOISON_MEMORY_REGION(result, size);
- DCHECK_LE(info.allocated_bytes + size, info.chunk.size);
- info.allocated_bytes += padding + size;
- total_allocated_bytes_ += padding + size;
+ ASAN_UNPOISON_MEMORY_REGION(result, size_with_padding);
+ DCHECK_LE(info.allocated_bytes + size_with_padding, info.chunk.size);
+ info.allocated_bytes += padding + size_with_padding;
+ total_allocated_bytes_ += padding + size_with_padding;
DCHECK_LE(current_chunk_idx_, chunks_.size() - 1);
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org