Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Version 2.0.1' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Version 2.0.1
Authored by: wallybear on Apr 12, '12 03:39:07AM
More concise script:

#!/bin/bash

# This script checks the available inactive memory.
# Memory is purged if the available number of MB is
# greater than the following "msize" variable. Attach
# this script to launchd to run it periodically.

msize=1200

MM=`vm_stat | awk '/Pages\ inactive\:/ {print int($3/256)}'`

echo "Testing status of inactive free memory..."

if [ "$MM" -gt "$msize" ]; then
  echo "You have too much inactive free memory. ${MM}MB Releasing now..."
  purge
else
  echo "Memory amount ${MM}MB does not meet purge threshold."
fi
("exit 0" is redundant, it's the standard exit code of a shell script in case of no errors.)
Edited on Apr 12, '12 03:49:00AM by wallybear


[ Reply to This | # ]