有大哥能提供一个效率高点的内存整理代码?
有大哥能提供一个效率高点的内存整理代码?小弟先谢谢了
[ 本帖最后由 superflq 于 2008-10-28 14:44 编辑 ] 官方有个,论坛出有人发了上来,但只是将物理内存转到虚拟内存中. 我搜索了,搜索不到么 整理系统内存的
#include <process.au3>
If WinExists("RAM_Clean") Then Exit
AutoItWinSetTitle("RAM_Clean")
FileInstall("empty.exe", @TempDir & "\empty.exe")
HotKeySet("!{Pause}", "_RAM_Clean")
HotKeySet("!{Del}", "Delete")
Break(0)
Local $T, $I, $L
Input_timer()
TraySetToolTip("自动整理间隔为:" & $T & "分钟" & @LF & "按ALT+PAUSE立即整理,按ALT+DEL退出!")
While 1
Call("Clean")
Sleep(4000)
TrayTip("", "", 1)
Sleep(($T * 60000) - 8000)
WEnd
Func _RAM_Clean()
TrayTip("", "开始整理内存...", 1)
$mem = MemGetStats()
$list = ProcessList()
For $I = 1 To $list
$line = "empty.exe" & Chr(32) & $list[$I]
If $list[$I] <> 0 And $list[$I] <> 4 Then
RunWait(@ComSpec & " /c " & $line, "", @SW_HIDE)
EndIf
Next
$mem1 = MemGetStats()
$var = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "EnableBalloonTips")
If $var = 0 Then
ToolTip("整理前可用/整理后可用" & Chr(13) & Chr(13) & Round($mem / 1024, 1) & "/" & Round($mem1 / 1024, 1) & Chr(32) & "MB", @DesktopWidth - 135, @DesktopHeight - 76)
Sleep(4000)
ToolTip("")
Else
TrayTip("整理前可用/整理后可用", Round($mem / 1024, 1) & "/" & Round($mem1 / 1024, 1) & Chr(32) & "MB", 4, 1)
Sleep(4000)
EndIf
TrayTip("", "内存整理结束...", 1)
EndFunc ;==>Clean
Func Delete()
FileDelete(@TempDir & "\empty.exe")
Exit
EndFunc ;==>Delete
Func Input_timer()
$T = InputBox("内存整理", "自动整理的间隔时间(分钟)", 20, " 2", 190, 115, -1, -1, 6)
Select
Case @error = 1 Or @error = 3
Exit
Case @error = 2
$T = 10
Case StringIsDigit($T) = 0
Input_timer()
EndSelect
EndFunc ;==>Input_timer 楼上的。empty.exe是什么东东? 原帖由 ceoguang 于 2008-10-27 14:03 发表 http://www.autoitx.com/images/common/back.gif
楼上的。empty.exe是什么东东?
微软的内存清理程序 提示说empty.exe不存在, http://www.1msoft.com/column/system-yingyong/MemoryEmpty.html3 http://www.1msoft.com/column/system-yingyong/MemoryEmpty.html3
另外有个内存释放代码
_ReduceMemory(@AutoItPID)
Func _ReduceMemory($i_PID = -1)
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle)
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle)
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return
EndFunc ;==>_ReduceMemory
用AutoIt增强微软内存释放工具Empty 谁能提供一下这个软件的代码 谢谢BOB,支持
页:
[1]