取当前进程内存使用量

 

使用单元:uses Psapi;

 

procedure TForm1.Button10Click(Sender: TObject);
var
b: Boolean;
pmc: TProcessMemoryCounters;
h: THandle;
I, J: Integer;
begin
h := GetCurrentProcess;
b := GetProcessMemoryInfo(h, @pmc, SizeOf(TProcessMemoryCounters));
if b then
begin
self.Memo1.Lines.Add(FormatDateTime('hh:mm:ss.zzz ', Now) + IntToStr(pmc.WorkingSetSize));
end;


// for I := 1 to 100 do
// begin
// SetLength(DataInfo, I);
//// for J := 0 to I - 1 do
//// DataInfo[J].ID := J;
// end;
//
// for I := 100 downto 1 do
// begin
// SetLength(DataInfo, I);
//// for J := 0 to I - 1 do
//// DataInfo[J].ID := J;
// end;
b := GetProcessMemoryInfo(h, @pmc, SizeOf(TProcessMemoryCounters));
if b then
begin
self.Memo1.Lines.Add(FormatDateTime('hh:mm:ss.zzz ', Now) + IntToStr(pmc.WorkingSetSize));
end;
end;

posted on 2018-05-04 11:17  疯狂delphi  阅读(756)  评论(0编辑  收藏  举报

导航