My Mac mini dashboard's memory donut tries USS first, the memory a process doesn't share. But macOS denies USS for 976 of 977 processes. So the whole donut quietly ran on RSS, which includes shared memory.
The fix is physical footprint, read with proc_pid_rusage → ri_phys_footprint. It's the number in Activity Monitor and top's MEM column. It counts compressed memory at full size, so slices can now exceed "used" instead of shrinking to fit. When they do, each keeps its real size and Other reads 0.
Ollama had a second bug: it was double-counted, as its runner's footprint plus the loaded model's GPU memory. But that footprint already holds the model's Metal buffers. Now it's the larger of the two.
On a test instance, the Docker slice read 11.22 GB, and top summed by hand gave 11.23 GB. Production had shown 9.82 GB for it, after quietly scaling RSS down.
A new test checks the footprint math, and all 143 tests pass.
Plain text: mac-memory-footprint-not-rss.md · Atom feed · All notes