This Applescript Frees Ram!! v1.0

-- Created By AudialRedux (c) 2011 
-- v1.0 

tell application "Finder"
	set diskName to (name of startup disk)
	set diskSpace to (free space of startup disk)
	--(*Number of bytes free.*)
	set diskSpace to (round (diskSpace * 1048576))
	(*Changes bytes into megabytes.*)
	set diskCap to (capacity of startup disk)
	--(*Number of bytes that the disk can hold.*)
	set diskCap to (round (diskCap / 1048576))
	set Cushion to (round (0.2 * diskCap))
	--(*20% of the disk.*)
	set diskSpace to (diskSpace - Cushion)
	--(*Amount of space left in disk.*)
	set CurDate to ((current date) as string)
end tell


set status to display dialog "On: " & CurDate & return & "The drive: " & diskName & return & "Has :" & diskSpace & "MBs available." buttons {"Ok Thanks!", "Free Ram!."} with title "Free Ram v1.0 By AudialRedux 2011" default button "Free Ram!." with icon note
if button returned of status = "Free Ram!." then
	do shell script "purge ram"
	do shell script "purge"
	delay 1.0
	tell application "Dock"
		quit
		launch
	end tell
end if
display dialog "Ram Freeing Completed! 100%"

This Part Frees Up Ram My Friend :slight_smile:

set status to display dialog "On: " & CurDate & return & "The drive: " & diskName & return & "Has :" & diskSpace & "MBs available." buttons {"Ok Thanks!", "Free Ram!."} with title "Free Ram v1.0 By AudialRedux 2011" default button "Free Ram!." with icon note
if button returned of status = "Free Ram!." then
   do shell script "purge ram"
   do shell script "purge"
   delay 1.0
   tell application "Dock"
       quit
       launch
   end tell
end if
display dialog "Ram Freeing Completed! 100%"

When you start an application and then quit it again and relaunch teh application again you’ll notice that the second time the applicication’s startup time is much shorter than the first time. This is because it re-uses ‘old’ memory. This means that even when you quit the application the memory isn’t fully released (freed). This memory is called ‘inactive memory’. The purge command is releasing this inactive memory, but inactive memory can be overwritten by another application so in fact there is no memory freed at all.

Then there are two problems with purge

  1. it comes with xode, so you need developer tools installed.
  2. Using snow leopard and 64 bit processor you’ll need xcode 3.2.3 or newer

DJ Bazzie Wazzie: Thank you for the information as i was not aware of basically the script is useless then.?

No It’s not useless at all. Purge is very useful when you don’t want to re-use old memory when launching the application. When Developing it is sometimes useful.