function GetAllocatedMemoryBytes_NativeMemoryManager : NativeUInt;// Get the size of all allocations from the memory managervar MemoryManagerState: TMemoryManagerState; SmallBlockState: TSmallBlockTypestate; i: Integer;begin GetMemoryManagerState( MemoryManagerState ); Result := 0; for i := low(MemoryManagerState.SmallBlockTypestates) to high(MemoryManagerState.SmallBlockTypestates) do begin SmallBlockState := MemoryManagerState.SmallBlockTypestates[i]; Inc(Result,SmallBlockState.AllocatedBlockCount*SmallBlockState.UseableBlockSize); end; Inc(Result,MemoryManagerState.TotalAllocatedMediumBlockSize); Inc(Result,MemoryManagerState.TotalAllocatedLargeBlockSize);end;
我使用XE2,因此您可能需要将NativeUInt更改为Int64.
总结以上是内存溢出为你收集整理的delphi – 如何衡量内存使用情况全部内容,希望文章能够帮你解决delphi – 如何衡量内存使用情况所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)