From 367c8f2363cebbcd6c37484d15e0863612bcc1c9 Mon Sep 17 00:00:00 2001
From: Brad Linden <46733234+brad-linden@users.noreply.github.com>
Date: Mon, 26 Aug 2024 17:24:07 -0700
Subject: Improve safety of macOS available RAM calcuations at suggestion of
 Ansariel and Beq (#2423)

---
 indra/llcommon/llmemory.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index 99c803e46f..ba48319a16 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -129,7 +129,7 @@ void LLMemory::updateMemoryInfo()
     {
         // Our Windows definition of PagefileUsage is documented by Microsoft as "the total amount of
         // memory that the memory manager has committed for a running process", which is rss.
-        sAllocatedPageSizeInKB = U32Bytes(info.resident_size);
+        sAllocatedPageSizeInKB = U32Kilobytes::convert(U64Bytes(info.resident_size));
 
         // Activity Monitor => Inspect Process => Real Memory Size appears to report resident_size
         // Activity monitor => main window memory column appears to report phys_footprint, which spot checks as at least 30% less.
@@ -139,7 +139,7 @@ void LLMemory::updateMemoryInfo()
         // reported for the app by the Memory Monitor in Instruments.' It is still about 8% bigger than phys_footprint.
         //
         // (On Windows, we use WorkingSetSize.)
-        sAllocatedMemInKB = U32Bytes(info.resident_size - info.reusable);
+        sAllocatedMemInKB = U32Kilobytes::convert(U64Bytes(info.resident_size - info.reusable));
      }
     else
     {
-- 
cgit v1.2.3