From 133d229361b05eeeb32a622c809dfae3acf61b2e Mon Sep 17 00:00:00 2001 From: henrygd Date: Thu, 25 Sep 2025 19:19:32 -0400 Subject: [PATCH] add fallback cache/buff memory calculation when cache/buff isn't available (#1198) --- agent/system.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agent/system.go b/agent/system.go index ad0a35ca..b2952a3e 100644 --- a/agent/system.go +++ b/agent/system.go @@ -102,6 +102,9 @@ func (a *Agent) getSystemStats() system.Stats { // cache + buffers value for default mem calculation // note: gopsutil automatically adds SReclaimable to v.Cached cacheBuff := v.Cached + v.Buffers - v.Shared + if cacheBuff <= 0 { + cacheBuff = max(v.Total-v.Free-v.Used, 0) + } // htop memory calculation overrides (likely outdated as of mid 2025) if a.memCalc == "htop" { // cacheBuff = v.Cached + v.Buffers - v.Shared