[pick](branch-2.1) pick #42059 (#44938)

This commit is contained in:
Xinyi Zou
2024-12-04 17:49:08 +08:00
committed by GitHub
parent 19b63bb437
commit 02fdf5307c
17 changed files with 313 additions and 68 deletions

View File

@ -64,6 +64,7 @@
#include "runtime/load_path_mgr.h"
#include "runtime/load_stream_mgr.h"
#include "runtime/memory/cache_manager.h"
#include "runtime/memory/heap_profiler.h"
#include "runtime/memory/mem_tracker.h"
#include "runtime/memory/mem_tracker_limiter.h"
#include "runtime/memory/thread_mem_tracker_mgr.h"
@ -389,6 +390,7 @@ Status ExecEnv::_init_mem_env() {
bool is_percent = false;
std::stringstream ss;
// 1. init mem tracker
_heap_profiler = HeapProfiler::create_global_instance();
init_mem_tracker();
thread_context()->thread_mem_tracker_mgr->init();
#if defined(USE_MEM_TRACKER) && !defined(__SANITIZE_ADDRESS__) && !defined(ADDRESS_SANITIZER) && \
@ -701,6 +703,8 @@ void ExecEnv::destroy() {
// dns cache is a global instance and need to be released at last
SAFE_DELETE(_dns_cache);
SAFE_DELETE(_heap_profiler);
_s_tracking_memory = false;
LOG(INFO) << "Doris exec envorinment is destoried.";
}