Performance Zone is brought to you in partnership with:

I'm an independent contractor, solving all kinds of problems. I am specialized in Java and websites. And I'm the author of www.takeon.me, for which I have almost every role a company could think of ... Developer, Server admin, DBA, Architect, Tester, Marketing guy, CEO ... :) Aurelien is a DZone MVB and is not an employee of DZone and has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

Reclaim some memory on Mac OS

07.20.2013
| 876 views |
  • submit to reddit

 his is a recurring issue for me, having not enough memory on my Mac, so here are some useful commands:

Display how much the memory is used by processes, reclaim some and verify again:

ps -axm -o "rss,comm" | awk 'BEGIN { s=0;}; {s=s+$1;}; END { printf("%.2f GB\n", (s/1024.0/1024));}'
purge
ps -axm -o "rss,comm" | awk 'BEGIN { s=0;}; {s=s+$1;}; END { printf("%.2f GB\n", (s/1024.0/1024));}'
Published at DZone with permission of Aurelien Broszniowski, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)