« ガチャピンチャレンジがDSになった | メイン | 読書メモ:ウケる技術 »

Release Memory for Leopardを作ってみた

- MacOSX

Leopardはメモリ管理が結構賢くなったので、メモリ解放は要らないかと思っていたものの、やっぱりスワップファイルが5個とか6個とかできると、なんか動作が遅くなる気がする。 (→Release Memoryの役目は終わったかも(Leopard) (うむらうす)

そこで、気が向いたので、なぜか今頃になってRelease MemoryをLeopardに対応させてみた。 いろいろやってみた結果、Dockの再起動とlocate databaseの再構築は効くと判断。 他のおまじないは残しておく。

そもそもRelease Memoryって何?という人は、wakabaさんによる説明を参考されたい。 私の説明よりよっぽど丁寧でわかりやすい。
わかばマークのMacの備忘録 : Release Memory2 

ということでRelease Memory for Leopardを作った。

何をするの?

やっていることは以下の通り。

  1. Finder再起動
  2. Dock再起動
  3. Dashboard cache消去
  4. locate databaseの更新

4.に管理者権限が必要らしいので、パスワードを要求されるのでうろたえないこと。 パスワード入力が不安な人は、ソースは確認して安心してから走らせて欲しい。 Scriptスタートから終了までには3〜4分かかるので、お茶をすするなり瞑想するなりして過ごして欲しい。

いつ使うの?

良く効くタイミング:
長くネットサーフィンなど作業したとき。重いアプリを終了させた直後。

効きにくいタイミング:
ついさっきRelease Memoryを走らせたばかり。

ダウンロード

以下に、終了をダイアログで知らせるか、Growlで知らせるか、2通りのスクリプトを上げておく。 好みで使い分けて欲しい。

・ダイアログでお知らせバージョン
→ Release Memory for Leopard.zip

・Growlでお知らせバージョン
→ Release Memory for Leopard(Growl).zip

使い方

zipファイルにしてあるので、ダブルクリックするなどして解凍し、
/ホーム/ライブラリ/Scripts/
に放り込んでおくと、スクリプトメニューからアクセスできるようになる。 スクリプトメニューの使い方は、↓の「方法2:スクリプトメニューに登録する」を参照のこと。
NBA TVのvideoを手軽に楽しむ (うむらうす)

そしていつも通り、こいつがなにか暴走しても何の保証もしかねますので、ご利用は自己責任でお願いします。 (自分で言うのもなんだが、なぜdatabaseを更新するとメモリが解放されるのかよくわからない)

でもね、メモリ解放に一番効くのは、ブラウザとか重いアプリをマメに終了させることなんですよね。


7/5追記:
mutaさんに紹介していただいた。 いつもありがとうございます。
Release Memory for Leopard(Growl)(Freeware)
追記ここまで

関連記事:
スワップファイルをなくそう4 - Release Memory2 (for Tiger) (うむらうす)
空きメモリ確保AppleScript「Freemem Keeper」作った (うむらうす)
残り空きメモリ監視AppleScript「Freemem Monitor」作成 (うむらうす)

以下ソース。興味のある方はどうぞ。

ダイアログ版



-- 1 Restart Finder
tell application "Finder"
	quit
	delay 1
	activateFinder() of me
	if exists Finder window 1 then
		activate
		set windowBounds to (bounds of Finder window 1)
		set theFolder to target of Finder window 1
		close Finder window 1
		open theFolder
		set bounds of Finder window 1 to windowBounds
	end if
	
	
end tell
on activateFinder()
	try
		tell application "Finder" to activate
	on error
		activateFinder() of me
	end try
end activateFinder

--2.Restart Dock
do shell script "killall Dock"

--3.Delete Dashboard cache
do shell script "rm -rf ~/Library/Caches/DashboardClient/*"

--4.Update locate database
do shell script "/usr/libexec/locate.updatedb" with administrator privileges


display dialog "Release Memory Finished" buttons {"OK"}

Growl版



-- for Growl
tell application "GrowlHelperApp"
	-- Make a list of all the notification types 
	-- that this script will ever send:
	set the allNotificationsList to ¬
		{"Finished"}
	
	-- Make a list of the notifications 
	-- that will be enabled by default.      
	-- Those not enabled by default can be enabled later 
	-- in the 'Applications' tab of the growl prefpane.
	set the enabledNotificationsList to ¬
		{"Finished"}
	
	-- Register our script with growl.
	-- You can optionally (as here) set a default icon 
	-- for this script's notifications.
	register as application ¬
		"Release Memory for Leopard" all notifications allNotificationsList ¬
		default notifications enabledNotificationsList ¬
		icon of application "Script Editor"
end tell

-- 1 Restart Finder
tell application "Finder"
	quit
	delay 1
	activateFinder() of me
	if exists Finder window 1 then
		activate
		set windowBounds to (bounds of Finder window 1)
		set theFolder to target of Finder window 1
		close Finder window 1
		open theFolder
		set bounds of Finder window 1 to windowBounds
	end if
	
	
end tell
on activateFinder()
	try
		tell application "Finder" to activate
	on error
		activateFinder() of me
	end try
end activateFinder

--2.Restart Dock
do shell script "killall Dock"

--3.Delete Dashboard cache
do shell script "rm -rf ~/Library/Caches/DashboardClient/*"

--4.Update locate database
do shell script "/usr/libexec/locate.updatedb" with administrator privileges


--dialog with Growl
tell application "GrowlHelperApp"
	--       Send a Notification...
	notify with name ¬
		"Finished" title ¬
		"Finished" description ¬
		"Locate Database Updated." application name "Release Memory for Leopard"
	
end tell

web拍手とは

トラックバック

このエントリーのトラックバックURL:
http://soap.s216.xrea.com/umu/mt/mt-trackback-script.cgi/1386

この一覧は、次のエントリーを参照しています: Release Memory for Leopardを作ってみた:

» [mac]Release Memory for Leopardをいじってみました 送信元 Watsonのメモ
Release Memory for Leopardを作ってみたで、Mac OS Xのメモリを掃除するためのApple Scriptが公開されていたので... [詳しくはこちら]

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)

最近のコメント

最近のトラックバック

アーカイブ

別館(annex)との統合フィードを取得
[フィードとは]
Add to Google
はてなRSSへ追加
My Yahooへ追加
Livedoorへ追加
gooへ追加
購読する Bloglines


Powered by FeedBurner

メールで購読
メールアドレスを入力してください:

配信: FeedBurner


このブログ単独のフィードを取得

クリエイティブ・コモンズ

Creative Commons License
このブログは、次のライセンスで保護されています。 クリエイティブ・コモンズ・ライセンス.
Powered by
Movable Type