Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I get tab happy with Google Chrome which chews up a lot of memory and slows down the system. Is there a way to get a warning when free memory falls below a certain threshold? That way I can close some things before serious performance degradation.

share|improve this question
up vote 5 down vote accepted

You can acheive this with a combination of Growl and some shell scripting.

Growlnotify is a command line tool that can send a message to growl:

grownnotify -t "Title" -m "Message"

Wrapping some logic around this to check for CPU use or Memory use should be straightforward enough. I'm not at a Mac right now so can't test with commands but something like the following should be possible

while true
sleep 60
memuse=`vmstat -some -options -to -show -current -memory -use | awk '{ print $column_that you_are_interested_in_eg_5 }'`
if [[ $memuse -gt 80 ]]
growlnotify -t "Memory Low" -m "Memory use is at $memuse %"

Thew above isn't going to work, please don't copy and paste it, but it's something to go on. You can expand the logic further easily by checking every 2 minutes, and if it's over 80% then check every 30 seconds to see if it's persistantly high and not just a spike, and if its still high after 3 checks then alert, otherwise don't etc.

share|improve this answer
This is great. Thanks. – boehj Feb 18 '12 at 23:00

If looks like @stuffe's answer does exactly what you ask, but if you don't want to get into scripting I have an alternative for you.

iStat Menus allows you to monitor many different system activities such as CPU Usage, hard drive space, network speed, temperature and memory usage. While it does not notify you, it stays up in your menu bar so you can tell when it's getting full just by a glance. You can also click on it and see what all is taking up the most memory:

enter image description here

share|improve this answer
Your answer could appear in a different location due to voting or subsequent answers. It might be better to refer to another answer by the answer's author and/or a summary of the answer. – bneely Feb 16 '12 at 12:44
I edited my answer to reflect this. Thanks for the feedback. – Matt Love Feb 16 '12 at 13:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.