3

My MacBook Pro has 8G RAM. Recently memory leak offen happened. Page outs and swap used kept increasing. The last time it used ~8G swap space.

But in Activity Monitor, I can't find any process has a large value in 'Real Mem', 'Private Mem' nor 'Shared Mem' column.

I checked the %MEM column in output of 'ps -ev', all processes occupied less than 1% of memory. The full output is put in this gist: https://gist.github.com/aleung/4760556

What the way to diagnose OSX memory leak issue?

  • The %mem statistic seems to be ... weird. I can't figure out what it's a percentage of. Try ps -axv instead, and take a look at the RSS (resident memory in KB) and VSZ (virtual memory, also KB) columns. – Gordon Davisson Feb 12 '13 at 7:13
  • Memory leak might be caused by Isolator.app. Since I removed this app, free memory > 3G for a few days. But this question is still valid, because seeing the output from both Activity Monitor and ps -axv, Isolator.app used not too much memory. – aleung Feb 18 '13 at 9:19
  • I am in a similar situation, and would also like to know the answer. Perhaps we should look in the console and system logs. – user55316 Aug 18 '13 at 14:09
  • Maybe App Tamer? – Daniel Springer Sep 29 '17 at 15:13
1

Check with this command (will show more processes):

sudo ps -awxm -o %mem,rss,comm | sort -nr | head

if won't help, check with fs_usage to display system calls and page faults related to filesystem:

sudo fs_usage -f filesys,diskio

especially page in and out by appending the following to above command:

| egrep -i "page_|pgin|pgout"

Add extra | grep -v kernel to ignore kernel process or | grep -v 0.00 to show these with higher time spent.

If your swap is big, you can force disk cache to be flushed and emptied by: sudo purge.

Based on my experience, OS X have some issues with managing the memory after higher uptime (when it used all of free memory), so sometimes only full restart may help.

Check also sudo iotop or sudo vm_stat 1 commands which may help.

See also: How to investigate high kernel task memory usage?

0

I'm using a simple free app named SystemPal. It puts a small app in menu bar which you can check anytime you want. it lists the top 4 current processes in terms of memory usage and CPU usage. While not nearly as complete as the Activity Monitor or top from the terminal, you can use this app anytime without stopping your work. Also, shows how your memory is being used by displaying a small pie chart. This app gives a quick overview that often helps me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .