news.ycombinator.com• Jun 8, 2012• 1 min read
Script to Release Inactive Memory on Mac OSX LionHi, Last year I bought a 27" iMac with 8 Gig of memory with Lion. The machine is fantastic but Lions memory management has alot to be desired, it would totally stall when the inactive memory was about 3 Gig and the Free Memory around 50 Meg, and running purge would release some memory but less than an hour later I was in the same position.In my investigations I have finally found a script which clears the inactive memory down from over 1.2 Gig down to about 90 Meg.I cannot take credit for it, I found it here (http://hints.macworld.com/article.php?story=20120410153721860)Without further ado, the script is below, copy it into a file and chmod +x it and run....#!/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=1200VS=`vm_stat | awk '/Pages\ inactive\:/ {print $3}' | sed 's/\.//g'` MM=`echo "$VS/255" | bc`echo "Testing s