Beispiel 1 :
procedure TrimAppMemorySize;
var
MainHandle : THandle;
begin
try
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID) ;
SetProcessWorkingSetSize(MainHandle, $FFFFFFFF, $FFFFFFFF) ;
CloseHandle(MainHandle) ;
except
end;
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TrimAppMemorySize;
end;
Beispiel 2 :
procedure DSiTrimWorkingSet;
var
hProcess: THandle;
begin
hProcess := OpenProcess(PROCESS_SET_QUOTA, false, GetCurrentProcessId);
try
SetProcessWorkingSetSize(hProcess, $FFFFFFFF, $FFFFFFFF);
finally CloseHandle(hProcess); end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DSiTrimWorkingSet;
end;
Keine Kommentare:
Kommentar veröffentlichen