Reprinted from: http://hi.baidu.com/jdchenjian/blog/item/6acec502c8bbab703912bbf9.html
AutoHotkey is powerful and simple to use, with a slightly larger memory footprint (about 4M) compared to other similar software (such as Hoekey). But if your AutoHotkey (or the compiled. exe program) resides in memory, most of the time just waiting for the hotkey in the background or waiting for other tasks, there is a way to reduce its memory footprint. I tried Empty.exe this gadget and it worked very well.
Empty.exe is a command-line gadget from Microsoft (program size 9.5k only) that can be used to release memory that is consumed by the specified application.
Its application format is: Empty.exe process pid or Empty.exe process name
Click here to download Empty.exe
You can place the Empty.exe in the script directory or in the system Temp folder, adding the following line of code when the script is transferred from the foreground to the background, or when a hotkey response is completed:
Runwait, Empty.exe autohotkey.exe,,hide
If the script is compiled into an EXE file, it is changed to the following line:
Runwait, Empty.exe%a_scriptname%,,hide
It does this by calling Empty.exe to free its own free memory after AutoHotkey (or EXE) completes a task. This can greatly reduce the memory footprint of AutoHotkey (or the compiled. exe program). Here is a comparison of autohotkey memory consumption before and after adding this line of code:
Before using Empty.exe:
After using Empty.exe:
From the above comparison, AutoHotkey occupied memory from 4M to about 500k, and does not increase the use of virtual memory (both front and back are 1460k). Empty.exe can be seen instead of transferring memory to virtual memory as part of a memory-finishing software, which actually lowers the memory that the application consumes.