From 6d7801de8778651347ae2a31f134c8ea804019fe Mon Sep 17 00:00:00 2001 From: Zonghang Li Date: Wed, 4 Dec 2024 10:36:43 +0400 Subject: [PATCH] fix available_memory calculation --- common/profiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/profiler.cpp b/common/profiler.cpp index 3e98803e..120580d9 100644 --- a/common/profiler.cpp +++ b/common/profiler.cpp @@ -404,7 +404,7 @@ static uint64_t device_host_physical_memory(bool available) { if (available) { if (host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stats, &count) == KERN_SUCCESS) { - memory = (vm_stats.internal_page_count - vm_stats.purgeable_count) * sysconf(_SC_PAGESIZE); + memory = total_memory - (vm_stats.internal_page_count - vm_stats.purgeable_count) * sysconf(_SC_PAGESIZE); } else { LOG_INF("host_statistics64 failed\n"); }