//current memory size of the current process in bytes function CurrentMemoryUsage: Cardinal; var pmc: TProcessMemoryCounters; begin pmc.cb := SizeOf(pmc) ; if GetProcessMemoryInfo(GetCurrentProcess, @pmc, SizeOf(pmc)) then Result := pmc.WorkingSetSize else RaiseLastOSError; end;
To display the memory usage in KB, use: ShowMessage(FormatFloat('Memory used: ,.# K', CurrentMemoryUsage / 1024)) ;