refactor: calculate memory using free

Co-authored-by: Tobias Kussel <TKussel@users.noreply.github.com>
This commit is contained in:
Torben Brenner 2024-02-23 08:27:06 +01:00 committed by GitHub
parent 7d07c0623d
commit b5ef856f12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 2 deletions

View File

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