Fix memory leak by calling in mem hook (#12708)

After the consume mem tracker exceeds the mem limit in the mem hook, the boost stacktrace will be printed. A query/load will only be printed once, and the process tracker will only be printed once per second.

After the process memory reaches the upper limit, the boost stacktrace will be printed every second. The observed phenomena are as follows:

After query/load is canceled, the memory increases instantly;
tcmalloc profile total physical memory is less than perf process memory;
The process mem tracker is smaller than the perf process memory;
This commit is contained in:
Xinyi Zou
2022-09-18 10:04:15 +08:00
committed by GitHub
parent 2e41976b07
commit a73b28789d

View File

@ -213,7 +213,8 @@ void MemTrackerLimiter::print_log_usage(const std::string& msg) {
} else {
detail += "\n" + log_usage();
}
detail += "\n" + boost::stacktrace::to_string(boost::stacktrace::stacktrace());
// TODO: memory leak by calling `boost::stacktrace` in mem hook
// detail += "\n" + boost::stacktrace::to_string(boost::stacktrace::stacktrace());
LOG(WARNING) << detail;
_print_log_usage = false;
}