mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +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)
|
if (current_thread->untracked_memory == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_thread->memory_tracker.adjustWithUntrackedMemory(current_thread->untracked_memory);
|
current_thread->flushUntrackedMemory();
|
||||||
current_thread->untracked_memory = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -144,6 +144,12 @@ ThreadStatus::ThreadStatus()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThreadStatus::flushUntrackedMemory()
|
||||||
|
{
|
||||||
|
memory_tracker.adjustWithUntrackedMemory(untracked_memory);
|
||||||
|
untracked_memory = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ThreadStatus::~ThreadStatus()
|
ThreadStatus::~ThreadStatus()
|
||||||
{
|
{
|
||||||
memory_tracker.adjustWithUntrackedMemory(untracked_memory);
|
memory_tracker.adjustWithUntrackedMemory(untracked_memory);
|
||||||
|
@ -290,6 +290,8 @@ public:
|
|||||||
|
|
||||||
void logToQueryViewsLog(const ViewRuntimeData & vinfo);
|
void logToQueryViewsLog(const ViewRuntimeData & vinfo);
|
||||||
|
|
||||||
|
void flushUntrackedMemory();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void applyQuerySettings();
|
void applyQuerySettings();
|
||||||
|
|
||||||
|
@ -352,8 +352,10 @@ void ThreadStatus::detachQuery(bool exit_if_already_detached, bool thread_exits)
|
|||||||
thread_group->threads.erase(this);
|
thread_group->threads.erase(this);
|
||||||
}
|
}
|
||||||
performance_counters.setParent(&ProfileEvents::global_counters);
|
performance_counters.setParent(&ProfileEvents::global_counters);
|
||||||
memory_tracker.reset();
|
|
||||||
|
|
||||||
|
flushUntrackedMemory();
|
||||||
|
|
||||||
|
memory_tracker.reset();
|
||||||
memory_tracker.setParent(thread_group->memory_tracker.getParent());
|
memory_tracker.setParent(thread_group->memory_tracker.getParent());
|
||||||
|
|
||||||
query_id.clear();
|
query_id.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user