const Frequency = 5000;//每隔五秒钟整理一次内存,速度很快的 :) var TimerID: Integer; InProc: Boolean;
procedure SaveMemory; begin if Win32Platform = VER_PLATFORM_WIN32_NT then begin //整理内存 SetProcessWorkingSetSize(GetCurrentProcess, $FFFFFFFF, $FFFFFFFF); end; end;
//定时器要执行的回调函数 procedure HearBeatProc(Wnd: HWnd; Msg, Event, dwTime: Integer); stdcall; begin if (InProc = False) then begin InProc := True; try SaveMemory; finally InProc := False; end; end; end;