(Gast)
n/a Beiträge
|
AW: Speicherlast des Programms mittels GetMemoryManagerState - komischer Wert
7. Nov 2016, 21:33
Guck mal hier:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
function GetCurrentProcessMemorySize: Int64;
var
nWndHandle, nProcID, nTmpHandle: HWND;
pPMC: PPROCESS_MEMORY_COUNTERS;
pPMCSize: Cardinal;
begin
nWndHandle := Application.Handle;
if nWndHandle = 0 then
begin
Result := 0;
Exit;
end;
pPMCSize := SizeOf(PROCESS_MEMORY_COUNTERS);
GetMem(pPMC, pPMCSize);
pPMC^.cb := pPMCSize;
GetWindowThreadProcessId(nWndHandle, @nProcID);
nTmpHandle := OpenProcess(PROCESS_ALL_ACCESS, False, nProcID);
if (GetProcessMemoryInfo(nTmpHandle, pPMC, pPMCSize)) then
Result := pPMC^.WorkingSetSize
else
Result := 0;
FreeMem(pPMC);
CloseHandle(nTmpHandle);
end;
begin
ShowMessage(IntToStr(GetCurrentProcessMemorySize)));
end;
Das zeigt den Arbeits satz an.
Quelle: http://snipplr.com/view/38214/get-process-memory-usage/
|
|
Zitat
|