You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/16 15:07:38 UTC

[GitHub] [incubator-doris] xinyiZzz commented on a diff in pull request #9581: [Enhancement] [Memory] [Vectorized] Stress test and optimize memory allocation

xinyiZzz commented on code in PR #9581:
URL: https://github.com/apache/incubator-doris/pull/9581#discussion_r873843542


##########
be/src/runtime/memory/chunk_allocator.cpp:
##########
@@ -219,6 +224,10 @@ void ChunkAllocator::free(const Chunk& chunk, MemTracker* tracker) {
         }
     } while (!_reserved_bytes.compare_exchange_weak(old_reserved_bytes, new_reserved_bytes));
 
+    // Reduce set metric frequency
+    if (_reserved_bytes % 100 == 32) {

Review Comment:
   At the first look, ChunkAllocator will allocate/free many times, the memory size of each allocate/free is a multiple of 2, so `_reserved_bytes% 100 == 32` will definitely happen, and the latest `_reserved_bytes` value will be set each time .
   
   The real-time and accurate `_reserved_bytes` value is not required. Usually, the value of `_reserved_bytes` is equal to ChunkAllocator MemTracker. The `_reserved_bytes` metric is only concerned when verifying the accuracy of MemTracker.
   
   Therefore, reduce the number of sets and reduce the performance impact.



-- 
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-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org