4

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?

3
  • 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. Commented Feb 12, 2013 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
    Commented Feb 18, 2013 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
    Commented Aug 18, 2013 at 14:09

1 Answer 1

3

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?

You must log in to answer this question.

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