brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: footprint shows what one Mac process's memory is made of

Memory
~/tips/tip-macos-footprint-process-memory

footprint Safari

Breaks down the memory footprint of a process into categories, with optional sampling.

Activity Monitor gives me one memory number per process. When I want to know what that number is made of, footprint in Terminal breaks it down by category.

Give it a process ID or a name. Partial names work too, and every process that matches gets reported:

footprint Safari

According to the man page it shows all addressable memory, but it emphasizes the memory the kernel considers dirty. A process’s footprint equals the total of its Dirty column, and dirty memory is the part the kernel cannot reclaim on its own. By default you get one total per memory category. Add -v to see every region.

With several processes it counts shared objects once and lists them apart from private ones, then prints a combined total. Some options I reach for:

  • --sort Clean sorts by another column than the default Dirty
  • -t includes the children of the process
  • -j report.json also saves the data as JSON
  • --sample 5 repeats the measurement every 5 seconds until Control-C

The sampling mode is handy for watching one app grow. This takes a reading every 5 seconds for a minute:

footprint --sample 5 --sample-duration 60 Safari

The caveat is permissions: footprint must run as root for processes you do not own, so a system process needs sudo. It also describes the processes you name, not your whole Mac, and the man page says one of its modes can give totals that differ from top or Activity Monitor.

Further reading: footprint man page

More Memory tips lsmem --summary for f in /proc/[0-9]*/status; do sudo apt install smem sudo pmap -x 1234 sudo systemctl edit indexer.service All Memory tips (12) All topics

Link