From 52be66f2152db3819590d98b9b32b51703e94f22 Mon Sep 17 00:00:00 2001 From: Yongqiang YANG Date: Thu, 1 Dec 2022 14:14:23 +0000 Subject: [PATCH] [fix](tcmalloc) gc does not work in somecases --- be/src/common/daemon.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/be/src/common/daemon.cpp b/be/src/common/daemon.cpp index fc49853bb5a92e..da85028bb50e47 100644 --- a/be/src/common/daemon.cpp +++ b/be/src/common/daemon.cpp @@ -129,16 +129,13 @@ void Daemon::tcmalloc_gc_thread() { to_free_bytes = std::max(to_free_bytes, tc_cached_bytes * 30 / 100); to_free_bytes = std::min(to_free_bytes, tc_cached_bytes); expected_aggressive_decommit = 1; - } else { - // release rate is enough. - to_free_bytes = 0; } last_ms = kMaxLastMs; } else if (memory_pressure > (pressure_limit - 10)) { + // In most cases, adjusting release rate is enough, if memory are consumed quickly + // we should release manually. if (last_memory_pressure <= (pressure_limit - 10)) { to_free_bytes = std::max(to_free_bytes, tc_cached_bytes * 10 / 100); - } else { - to_free_bytes = 0; } } @@ -172,6 +169,7 @@ void Daemon::tcmalloc_gc_thread() { last_ms = 0; } } else { + DCHECK(tc_cached_bytes <= tc_used_bytes * max_cache_percent / 100); last_ms = 0; } }