From e44df27c961374c72079e029064b311a342be271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 27 Jan 2026 14:24:38 +0800 Subject: [PATCH] Memory (macOS): adds debug info Usage: `fastfetch -s memory:swap -l none --dynamic-interval 1000 --debug --no-buffer` See https://github.com/fastfetch-cli/fastfetch/issues/2171#issuecomment-3803309478 --- src/detection/memory/memory_apple.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detection/memory/memory_apple.c b/src/detection/memory/memory_apple.c index a24dba32e..21a6d15ae 100644 --- a/src/detection/memory/memory_apple.c +++ b/src/detection/memory/memory_apple.c @@ -1,4 +1,5 @@ #include "memory.h" +#include "common/debug.h" #include #include @@ -21,11 +22,16 @@ const char* ffDetectMemory(FFMemoryResult* ram) return "Failed to read host_statistics64"; uint64_t pageSize = instance.state.platform.sysinfo.pageSize; - uint64_t appMemory = vmstat.internal_page_count * pageSize; + uint64_t appMemory = vmstat.internal_page_count * pageSize; // memory allocated by `mmap(..., MAP_ANON | MAP_PRIVATE, ...)`, i.e. malloc(3) uint64_t wiredMemory = vmstat.wire_count * pageSize; uint64_t compressed = vmstat.compressor_page_count * pageSize; uint64_t reserved = ram->bytesTotal - usableMemory; + FF_DEBUG("App: %.2f GiB", (double) appMemory / 1024. / 1024. / 1024.); + FF_DEBUG("Wired: %.2f GiB", (double) wiredMemory / 1024. / 1024. / 1024.); + FF_DEBUG("Compressed: %.2f GiB", (double) compressed / 1024. / 1024. / 1024.); + FF_DEBUG("Reserved: %.2f GiB", (double) reserved / 1024. / 1024. / 1024.); + ram->bytesUsed = appMemory + wiredMemory + compressed + reserved; return NULL;