yiguolei commented on code in PR #40572:
URL: https://github.com/apache/doris/pull/40572#discussion_r1751164754


##########
be/src/pipeline/exec/exchange_sink_buffer.cpp:
##########
@@ -421,8 +426,16 @@ void ExchangeSinkBuffer::_set_receiver_eof(InstanceLoId 
id) {
     std::unique_lock<std::mutex> lock(*_instance_to_package_queue_mutex[id]);
     _instance_to_receiver_eof[id] = true;
     _turn_off_channel(id, true);
-    std::queue<BroadcastTransmitInfo, std::list<BroadcastTransmitInfo>> empty;
-    swap(empty, _instance_to_broadcast_package_queue[id]);
+    std::queue<BroadcastTransmitInfo, std::list<BroadcastTransmitInfo>>& 
broadcast_q =
+            _instance_to_broadcast_package_queue[id];
+    for (; !broadcast_q.empty(); broadcast_q.pop()) {

Review Comment:
   把metric 这个单独的统计吧
   swap empty 不一定跟一个个pop 出来等价,可能stack 如果有一些优化,就不会释放内存



-- 
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]

Reply via email to