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 @@ -206,8 +206,6 @@ bool ThreadStatus::isQueryCanceled() const
206206
207207ThreadStatus::~ThreadStatus ()
208208{
209- flushUntrackedMemory ();
210-
211209 // / It may cause segfault if query_context was destroyed, but was not detached
212210 auto query_context_ptr = query_context.lock ();
213211 assert ((!query_context_ptr && getQueryId ().empty ()) || (query_context_ptr && getQueryId () == query_context_ptr->getCurrentQueryId ()));
@@ -218,6 +216,9 @@ ThreadStatus::~ThreadStatus()
218216
219217 chassert (!check_current_thread_on_destruction || current_thread == this );
220218
219+ // / Flush untracked_memory **right before** switching the current_thread to avoid losing untracked_memory in deleter (detachFromGroup)
220+ flushUntrackedMemory ();
221+
221222 // / Only change current_thread if it's currently being used by this ThreadStatus
222223 // / For example, PushingToViews chain creates and deletes ThreadStatus instances while running in the main query thread
223224 if (current_thread == this )
You can’t perform that action at this time.
0 commit comments