如何在Visual Studio中读取内存快照 [英] How to read the memory snapshot in Visual Studio

查看:147
本文介绍了如何在Visual Studio中读取内存快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio拍摄应用程序的内存快照.

I use Visual Studio to take memory snapshot of my application.

我对理解我得到的数据有一些疑问. 捕获内存快照后,我过滤出了我的一个类,例如MyClassPanel.我只在我的xmal文件中使用MyClassPanel.

I have some questions about understanding the data I got. I after I capture the memory snapshot, I filter out one of my class, say MyClassPanel. I only use MyClassPanel in my xmal files.

  1. 为什么MyClassPanel的根目录路径"都是"MyClassPanel [RefCount Handle,Count:1]"? (即,名称相同,但字符串[RefCount Handle末尾]和不同的Count值)是什么意思?在其他班级中,我进行了过滤,我看到通往根的路径"是不同的班级名称.

  1. why ‘Paths to Root’ for MyClassPanel are all ‘MyClassPanel [RefCount Handle, Count:1]’? (i.e. same name but with a string [RefCount Handle at the end] and a different Count value) what does this mean? In other class, I filter, I see the 'Paths to Root' are different class names.

我有24个MyClassPanel(从顶部表中的计数开始).在底表的引用计数"列中,当我将它们加起来时,它们就是24.

I have 24 MyClassPanel (from the count in top table). And in the ‘Reference Count’ column in the bottom table, when I add them up, they are 24.

总是这样吗?我认为计数"和引用计数"的含义不同.在这种情况下,它们加起来.这有道理吗?

Is that always the case? I think ‘Count’ and ‘Reference Count’ means different things. In this case, they add up. Does this make sense?

推荐答案

  1. 通往根的路径"视图显示了对此类型的引用,从而避免了对其进行垃圾回收.由于您的类是Xaml页面,因此使该类保持活动状态的引用是Xaml页面的CLR处理程序.这些显示为RefCount句柄.

  1. The Paths to Root view shows the references to this type keeping it from being garbage collected. Since your class is a Xaml page, the reference which keeps the class alive is a CLR handler for the Xaml page. These show up as RefCount Handle.

计数和引用计数确实不同. Count是实例数,引用数是引用数.因为在您的情况下,每个实例只有一个引用,所以它们加起来是有意义的.

Count and reference count are indeed not the same. Count is the number of instances, reference count the number of references. Because each instance in your case only has one reference, it makes sense they add up.

有关更多信息: http://blogs.msdn.com/b/visualstudioalm/archive/2013/06/20/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production .aspx http://blogs.msdn.com/b/visualstudioalm/archive/2013/10/16/net-memory-analysis-enhancements-in-visual-studio-2013.aspx

这篇关于如何在Visual Studio中读取内存快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆