procedure InstallMemoryAllocCount;
Puts the counting manager in front of the memory manager in use: from then on the counts see every heap call.
Result: stored in self (calling object)
Remarks:
Nothing else installs it. Raises EInvalidOpException if it is installed already. The counts go on from where they were when it was last removed. While it is installed, every heap call of every thread also updates two process-wide counters with atomic operations: it serves tests and profiling, not production code.
Examples
Installing twice raises.
uses Substr, System.SysUtils;
procedure Example;
var Raised: Boolean;
begin
InstallMemoryAllocCount;
Raised := False;
try
InstallMemoryAllocCount;
except
on EInvalidOpException do Raised := True;
end;
RemoveMemoryAllocCount;
Assert(Raised);
end;