From b5ef856f1283c3074a25add9eec116ec7ecd4578 Mon Sep 17 00:00:00 2001 From: Torben Brenner <76154651+torbrenner@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:27:06 +0100 Subject: [PATCH] refactor: calculate memory using free Co-authored-by: Tobias Kussel --- lib/functions.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/functions.sh b/lib/functions.sh index 66fb701..ab904d3 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -159,8 +159,7 @@ setHostname() { # the memory cap will be applied to both the java heap size and db clock cache setBlazeMemoryCap() { if [ -z "$BLAZE_MEMORY_CAP" ]; then - system_memory=$(grep MemTotal /proc/meminfo | grep -Po '\d+'); - system_memory_in_mb=$(("$system_memory"/1024)); + system_memory_in_mb=$(free -m | grep 'Mem:' | awk '{print $2}'); export BLAZE_MEMORY_CAP=$(("$system_memory_in_mb"/4)); fi }