[英]C# .NET - Is there a way to determine my app's memory usage per class/object type in runtime?
我有一个在云(Heroku)中运行的 C# .NET 应用程序,有时我会遇到内存泄漏。
我想在运行时从我的应用程序中获取详细的内存使用统计信息,因为我无法将调试器附加到远程进程。
如果我能在运行时从我的 C# 代码内部获得类似以下内容,那就太好了:
> dumpheap -stat
Statistics:
MT Count TotalSize Class Name
...
00007f6c1eeefba8 576 59904 System.Reflection.RuntimeMethodInfo
00007f6c1dc021c8 1749 95696 System.SByte[]
00000000008c9db0 3847 116080 Free
00007f6c1e784a18 175 128640 System.Char[]
00007f6c1dbf5510 217 133504 System.Object[]
00007f6c1dc014c0 467 416464 System.Byte[]
00007f6c21625038 6 4063376 testwebapi.Controllers.Customer[]
00007f6c20a67498 200000 4800000 testwebapi.Controllers.Customer
00007f6c1dc00f90 206770 19494060 System.String
Total 428516 objects
(来源: https ://docs.microsoft.com/en-us/dotnet/core/diagnostics/debug-memory-leak)
到目前为止,我找不到任何东西:免费库、第三方工具或代码片段。
您可以使用DotMemory 。 该工具将向您显示内存泄漏建议、总内存、每种类型对象的内存...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.