如何使用“内存使用情况”报告查找内存泄漏 [英] How to use Memory Usage report to find memory leaks
问题描述
我使用VS 2017内存使用情况报告来查找我的应用程序中的内存泄漏。
I use VS 2017 Memory Usage report to find memory leaks in my application.
以下是该报告的示例屏幕截图:
Here is a sample screenshot of the report:
我从报告中了解到的是保持对几个
I understand from the report the something is keeping references to several
vScriptManager对象实例的引用,我的代码实际上是一个错误。
vScriptManager object instances, what is actually an error in my code.
我的问题是,如何在我的代码中找到什么是对这些对象实例的引用?
My question is, how can I find in my code what is holding that references to these object instances ?
谢谢。
推荐答案
"根和引用类型的路径"窗格显示引用所选实例的对象以及所选实例引用的类型。但它没有提供我们可以直接使用源代码的功能。
当调试器在拍摄快照时停止时,您可以将鼠标悬停在"值"单元格上以显示对象的值工具提示:
The Paths to Root and Referenced Types pane display the objects that reference the selected instance and the types that the selected instance references. However it does not offer a feature that we could the source code directly. When the debugger is stopped at the point where the snapshot was taken, you can hover over the Value cell to display the values of the object in a tool tip:
https://docs.microsoft.com/en-us/visualstudio/profiling/memory-usage#managed-types-reports
如果我们使用Performance Profiler分析内存并生成报告,我们可以查看源代码右键单击函数名称的函数:
问候,
Fletcher
这篇关于如何使用“内存使用情况”报告查找内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!