Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Windows Server 2003 內建 Empty.exe 快速釋放記憶體工具使用教學

編輯:Windows 2003 教學

Windows Server 2003 內建 Empty.exe 命令列工具,可針對特定程序釋放其工作集,回收未主動使用的記憶體頁面,緩解記憶體壓力而不影響系統穩定。本文示範使用語法與實戰場景。

工具特性

  • 僅存在於 Windows Server 2003(Windows 2000/XP 無此工具)
  • 非強制整體記憶體整理,僅修剪指定程序的工作集
  • 不增加磁碟 I/O 負擔(不觸發分頁寫入)
  • 適合處理記憶體洩漏、長時間運行服務的週期性維護

使用語法

Empty.exe           # 依程序識別碼釋放
Empty.exe <程序名稱>       # 依程序名稱釋放(支援萬用字元)

Empty.exe工具介面

Empty.exe使用範例

Empty.exe僅支援Server 2003

實戰範例

  1. 釋放特定 PID:
    tasklist | findstr "sqlservr.exe" → 假設 PID=1234 → Empty.exe 1234
  2. 釋放所有同名程序:
    Empty.exe w3wp.exe(釋放所有 IIS 工作者進程工作集)
  3. 排程自動化:建立批次檔 release_mem.bat:
@echo off
rem 每日凌晨 03:00 釋放 IIS、SQL、Exchange 等服務工作集
Empty.exe w3wp.exe
Empty.exe sqlservr.exe
Empty.exe store.exe
Empty.exe inetinfo.exe

透過排程工作每日執行。

效果驗證

  1. 執行前記錄目標程序「記憶體使用量 (工作集)」(工作管理員/PerfMon)
  2. 執行 Empty.exe
  3. 觀察工作集下降幅度(通常回收 10-40% 視程序行為而定)
  4. 確認程序功能正常、無異常重啟

注意事項與限制

  • 頻繁執行可能導致程序效能暫時下降(需重新載入熱資料至實體記憶體)
  • 無法解決根本記憶體洩漏問題(需程式碼修復或重啟服務)
  • 關鍵資料庫/交易系統謹慎使用,建議維護窗口執行
  • 64 位元版 Windows Server 2003 同樣支援

替代方案比較

工具/方法適用範圍影響層面自動化難度
Empty.exe單一/群組程序工作集修剪低(命令列)
SetProcessWorkingSetSize API程式碼整合單一程序中(需開發)
重啟服務服務層級完全釋放+狀態重置低
第三方記憶體優化軟體全系統積極整理/分頁低

Empty.exe 是 Windows Server 2003 獨有的輕量級記憶體維護工具,善用它能延長服務重啟間隔、緩解記憶體壓力預警。

Copyright © Windows教程網 All Rights Reserved