mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
do flushUntrackedMemory when context swith
This commit is contained in:
parent
20bebf7a16
commit
a6c2473518
@ -129,8 +129,7 @@ void CurrentThread::flushUntrackedMemory()
|
||||
if (current_thread->untracked_memory == 0)
|
||||
return;
|
||||
|
||||
current_thread->memory_tracker.adjustWithUntrackedMemory(current_thread->untracked_memory);
|
||||
current_thread->untracked_memory = 0;
|
||||
current_thread->flushUntrackedMemory();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -144,6 +144,12 @@ ThreadStatus::ThreadStatus()
|
||||
#endif
|
||||
}
|
||||
|
||||
void ThreadStatus::flushUntrackedMemory()
|
||||
{
|
||||
memory_tracker.adjustWithUntrackedMemory(untracked_memory);
|
||||
untracked_memory = 0;
|
||||
}
|
||||
|
||||
ThreadStatus::~ThreadStatus()
|
||||
{
|
||||
memory_tracker.adjustWithUntrackedMemory(untracked_memory);
|
||||
|
@ -290,6 +290,8 @@ public:
|
||||
|
||||
void logToQueryViewsLog(const ViewRuntimeData & vinfo);
|
||||
|
||||
void flushUntrackedMemory();
|
||||
|
||||
protected:
|
||||
void applyQuerySettings();
|
||||
|
||||
|
@ -352,8 +352,10 @@ void ThreadStatus::detachQuery(bool exit_if_already_detached, bool thread_exits)
|
||||
thread_group->threads.erase(this);
|
||||
}
|
||||
performance_counters.setParent(&ProfileEvents::global_counters);
|
||||
memory_tracker.reset();
|
||||
|
||||
flushUntrackedMemory();
|
||||
|
||||
memory_tracker.reset();
|
||||
memory_tracker.setParent(thread_group->memory_tracker.getParent());
|
||||
|
||||
query_id.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user