Mac OS X: What is using my 'active' memory?

Even though no single process has high memory usage, there are still lots of processes running -- that all adds up.

Using ps and other command line tools, you can drill deeper into this.

First, use options to ps to limit what is shown to just resident memory and the name of the command. -m sorts output by memory usage, -a shows all users' processes, -x shows processes not associated with a terminal (i.e. most mac apps).

$ ps -axm -o "rss,comm" 

Here's the first few lines I see:

   RSS COMM
210256 /Applications/Firefox.app/Contents/MacOS/firefox-bin
158276 /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
155360 /Applications/iTunes.app/Contents/MacOS/iTunes

It's no shock to me that these are at the top (and the Chrome process shown is just one of a bunch). The RSS column is expressed as 1024 byte blocks. So iTunes is using about 151.7 MB.

That output is formatted well enough that you could throw it into a spreadsheet to analysis if you like analyzing things that way. I'll stick to the command line a little longer

String together a bunch more to see the sum of all processes:

$ ps -axm -o "rss,comm" | awk 'BEGIN { s=0;}; {s=s+$1;}; END { printf("%.2f GB\n", (s/1024.0/1024));}'

The output I see for that is 2.44 GB, not exactly what I see for Active memory in Activity Monitor, but close enough that I can use ps to get to the bottom of this.

You can add together just those processes using more than 100MB:

$ ps -axm -o "rss,comm" | awk 'BEGIN { c=0;s=0;}; ($1 > 100000) {c=c+1;s=s+$1;}; END { printf("%.2f GB from %d processes\n", (s/1024.0/1024),c);}'

0.98 GB from 8 processes

I haven't told you exactly what is using your mac's memory, but these tools will help you discover.


man -k DTrace. Those tools are the ones that will solve this. Goodluck