Leopardはメモリ管理が結構賢くなったので、メモリ解放は要らないかと思っていたものの、やっぱりスワップファイルが5個とか6個とかできると、なんか動作が遅くなる気がする。 (→Release Memoryの役目は終わったかも(Leopard) (うむらうす))
そこで、気が向いたので、なぜか今頃になってRelease MemoryをLeopardに対応させてみた。 いろいろやってみた結果、Dockの再起動とlocate databaseの再構築は効くと判断。 他のおまじないは残しておく。
そもそもRelease Memoryって何?という人は、wakabaさんによる説明を参考されたい。
私の説明よりよっぽど丁寧でわかりやすい。
→わかばマークのMacの備忘録 : Release Memory2
ということでRelease Memory for Leopardを作った。
何をするの?
やっていることは以下の通り。
- Finder再起動
- Dock再起動
- Dashboard cache消去
- 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







