下文摘自: http://51100k.blog.163.com/blog/static/2656032200953082658459/
在WinXp,Win2K(Vista、Windows7没有进行过测试,如果有人测试后,请转告我一下)中应用此方法,不显示主窗体一直运行的程序最佳。以前程序占用11M内存,我用动态创建窗口的方法只能减少不到100K,应用此方法后内存占用只有496K
{
************************************
* Clear Memory
* From Muse2008
************************************
}
procedure ClearMemory;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
Application.ProcessMessages;
end ;
end ;
************************************
* Clear Memory
* From Muse2008
************************************
}
procedure ClearMemory;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF);
Application.ProcessMessages;
end ;
end ;