在运行时检查 .NET 堆
有什么方法可以从 .NET 应用程序中遍历堆吗?我有一个 Silverlight 应用程序,希望能够检查堆中是否存在内存泄漏。我认为实现一个显示堆内容的调试弹出窗口会很好。我查看了 .NET API 命名空间,但找不到任何相关内容。
Is there any way to walk the heap from a .NET application? I have a Silverlight application and want to be able to examine the heap for memory leaks. I thought it would be nice to implement a debugging popup window that would display the contents of the heap. I have looked through the .NET API namespaces and can't find anything relevant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用SOS 调试扩展来检查您的托管内存分配程序。
这是一篇博客文章,介绍如何使用 Silverlight 执行此操作。
You can use the SOS Debugging Extension to examine the managed memory allocations in your program.
Here is a blog post walking through how to do this with Silverlight.
您还可以尝试 SysInternals 的工具ProcessExplorer。它有一个名为 .NET 的选项卡,您可以在其中找到许多有关 .NET 应用程序的特定数据(内存、垃圾收集器活动等)。每次我怀疑我的代码正在泄漏内存时,我都会使用此工具来检查并了解发生了什么。
You can also try the SysInternals's tool ProcessExplorer. It have a tab named .NET where you can find a lot of specific data about .NET applications (memory, garbage collector activity, etc). Every time I suspect that my code is leaking memory I use this tool to check and understand what is happening.