Substr.ProcessMemoryAllocCount Method

function ProcessMemoryAllocCount: NativeInt;

Process-wide: the heap calls of every thread - GetMem, AllocMem, ReallocMem and FreeMem - while the counting manager was installed.

Returns: NativeInt

Remarks:

Two readings around a region give its calls on all threads.

Examples

GetMem and FreeMem are two calls.

uses Substr;

procedure Example;
var p: Pointer;
    n: NativeInt;
begin
    InstallMemoryAllocCount;
    try
        n := ProcessMemoryAllocCount;
        GetMem(p, 100);
        FreeMem(p);
        Assert(ProcessMemoryAllocCount = n + 2);
    finally
        RemoveMemoryAllocCount;
    end;
end;