How could I get the total amount of memory, that allocated by FastMM?
I've tried that:
function GetTotalAllocatedMemory: Cardinal;
var
MMState: TMemoryManagerState;
begin
GetMemoryManagerState(MMState);
Result := MMState.TotalAllocatedMediumBlockSize + MMState.TotalAllocatedLargeBlockSize;
end;
Is it correct?
Anyways it returns something strange. It 5 times less than a value which I can see in Windows task manager. I believe that the amount of memory allocated by a Delphi application equals FastMM allocated memory plus some system overhead. Am I wrong?
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;
You are comparing apples and oranges.
FastMM memory is netto usage of memory allocated through FastMM.
This does not include at least these:
--jeroen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With