From 7fa3d113da9c4fb320cde54a8a9ecb3908c60248 Mon Sep 17 00:00:00 2001 From: bi4k8 Date: Wed, 26 Apr 2023 19:23:45 +0000 Subject: [PATCH] top: do not print ${top mem 1} as inf if $mem not used --- src/top.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/top.cc b/src/top.cc index 56f6dc3a..73a59e3e 100644 --- a/src/top.cc +++ b/src/top.cc @@ -388,6 +388,11 @@ static void process_find_top(struct process **cpu, struct process **mem, } int update_top() { + // if nothing else has ever set up info, we need to update it here, because + // info.memmax is used to print percentages in `print_top_mem` + if (info.memmax == 0) { + update_meminfo(); + } process_find_top(info.cpu, info.memu, info.time #ifdef BUILD_IOSTATS ,