Delphi

[Delphi] How to get the Memory Used by a Delphi Program

그저심 2022. 5. 14. 17:52

https://stackoverflow.com/questions/437683/how-to-get-the-memory-used-by-a-delphi-program

 

How to get the Memory Used by a Delphi Program

I know how to get the System memory use using GlobalMemoryStatusEx, but that tells me the what the entire OS is using. I really want my program to report how much memory it alone has allocated and...

stackoverflow.com

프로세스가 사용하고 있는 메모리 정보

uses psAPI;

function CurrentProcessMemory: Cardinal;
var
  MemCounters: TProcessMemoryCounters;
begin
  MemCounters.cb := SizeOf(MemCounters);
  if GetProcessMemoryInfo(GetCurrentProcess,
      @MemCounters,
      SizeOf(MemCounters)) then
    Result := MemCounters.WorkingSetSize
  else
    RaiseLastOSError;
end;
반응형