File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -203,8 +203,6 @@ bool ThreadStatus::isQueryCanceled() const
203203
204204ThreadStatus::~ThreadStatus ()
205205{
206- flushUntrackedMemory ();
207-
208206 // / It may cause segfault if query_context was destroyed, but was not detached
209207 auto query_context_ptr = query_context.lock ();
210208 assert ((!query_context_ptr && getQueryId ().empty ()) || (query_context_ptr && getQueryId () == query_context_ptr->getCurrentQueryId ()));
@@ -215,6 +213,9 @@ ThreadStatus::~ThreadStatus()
215213
216214 chassert (!check_current_thread_on_destruction || current_thread == this );
217215
216+ // / Flush untracked_memory **right before** switching the current_thread to avoid losing untracked_memory in deleter (detachFromGroup)
217+ flushUntrackedMemory ();
218+
218219 // / Only change current_thread if it's currently being used by this ThreadStatus
219220 // / For example, PushingToViews chain creates and deletes ThreadStatus instances while running in the main query thread
220221 if (current_thread == this )
You can’t perform that action at this time.
0 commit comments