FastMM: Total Allocated Memory

后端 未结 4 1909
刺人心
刺人心 2021-01-05 17:47

How could I get the total amount of memory, that allocated by FastMM?

I\'ve tried that:

function GetTotalAllocatedMemory: Cardinal;
var
  MMState: TM         


        
4条回答
  •  别那么骄傲
    2021-01-05 18:16

    For the process memory use this:

    //------------------------------------------------------------------------------
    // CsiGetProcessMemory
    //
    // Return the amount of memory used by the process
    //------------------------------------------------------------------------------
    function CsiGetProcessMemory: Int64;
    var
      lMemoryCounters: TProcessMemoryCounters;
      lSize: Integer;
    begin
      lSize := SizeOf(lMemoryCounters);
      FillChar(lMemoryCounters, lSize, 0);
      if GetProcessMemoryInfo(CsiGetProcessHandle, @lMemoryCounters, lSize) then
        Result := lMemoryCounters.PageFileUsage
      else
        Result := 0;
    end;
    

提交回复
热议问题