From 910ef4058604cc256928998b3da2165bdb768941 Mon Sep 17 00:00:00 2001 From: Bernard Sarfo Twumasi Date: Wed, 10 Jul 2024 21:01:19 +0200 Subject: [PATCH] Switch to using MemAvailable For Free Memory and Calculate the Used Memory (Fix Imports) --- pkg/memory/memory.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/memory/memory.go b/pkg/memory/memory.go index e2b582b..9c138ed 100644 --- a/pkg/memory/memory.go +++ b/pkg/memory/memory.go @@ -3,6 +3,7 @@ package memory import ( "fmt" "os" + "strconv" "strings" ) @@ -21,6 +22,9 @@ func GetMemoryInfo() MemoryInfo { return memoryInfo } + //Declare Variables for Calculation + var totalMem, availableMem int64 + // Parse the contents to get total, used, and free memory lines := strings.Split(string(memInfo), "\n") for _, line := range lines {