This piece of code is Windows only:

This piece of code is Windows only:

function MemoryUsed: cardinal; inline;

var

MMS: TMemoryManagerState;

Block: TSmallBlockTypeState;

begin

GetMemoryManagerState(MMS);

Result := MMS.TotalAllocatedMediumBlockSize + MMS.TotalAllocatedLargeBlockSize;

for Block in MMS.SmallBlockTypeStates

do Result := Result + (Block.UseableBlockSize * Block.AllocatedBlockCount);

end;

Is there something that is available on other platforms (POSIX) that can give me an idea of how much memory the app is using, without calling native OS functions?