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; } }