xinyiZzz commented on code in PR #32039:
URL: https://github.com/apache/doris/pull/32039#discussion_r1523031493
##########
be/src/runtime/thread_context.h:
##########
@@ -305,7 +356,18 @@ class SwitchThreadMemTrackerLimiter {
explicit SwitchThreadMemTrackerLimiter(const
std::shared_ptr<MemTrackerLimiter>& mem_tracker) {
ThreadLocalHandle::create_thread_local_if_not_exits();
_old_mem_tracker =
thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker();
-
thread_context()->thread_mem_tracker_mgr->attach_limiter_tracker(mem_tracker,
TUniqueId());
+
thread_context()->thread_mem_tracker_mgr->attach_limiter_tracker(mem_tracker);
+ }
+
+ explicit SwitchThreadMemTrackerLimiter(const QueryThreadContext&
query_thread_context) {
+ ThreadLocalHandle::create_thread_local_if_not_exits();
+ CHECK(thread_context()->task_id() ==
+ query_thread_context.query_id); // TODO modify to DCHECK
+ CHECK(thread_context()->thread_mem_tracker_mgr->fragment_instance_id()
==
+ query_thread_context.fragment_instance_id); // TODO modify to
DCHECK
Review Comment:
没问题,不管是一个函数内,还是一个线程上下层函数内,两次调用 SwitchThreadMemTrackerLimiter 后创建的临时变量
构造和析构的顺序是:construct A construct B destruct B destruct A,这样就没问题
--
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]