Visual Studio诊断 - 内存使用情况快照显示0分配 [英] Visual Studio Diagnostics - Memory usage Snapshot shows 0 Allocation

查看:512
本文介绍了Visual Studio诊断 - 内存使用情况快照显示0分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我长时间忽略了这个工具,因为它只是.NET。

I ignored this tool for a long time, because it was .NET only.


根据MSDN,诊断工具适用于本机代码,在Visual Studio 2015中在Debug中编译

According to MSDN, the diagnostics tool works for native code, compiled in Visual Studio 2015 in Debug


我在"内存使用"选项卡下的"诊断工具"窗口中启用"堆分析"。然后我重建所有项目,确保每个项目的工具集都是"Visual Studio 2015",并确保为每个dll或exe项目构建PDB。当主客户端连接到我的进程时,我在主服务器上设置断点
,然后在该客户端发送数据。两者之间有数以千计的新呼叫。每次我点击"拍摄快照"。单击拍摄快照时,会出现一行包含时间,分配和堆大小。后者
两个被清零。

I enable 'Heap Profiling' in the 'Diagnostic Tools' window, under the 'Memory Usage' tab. I then rebuild all, making sure the toolset is 'Visual Studio 2015' for every project, and making sure PDBs are built for every project that is a dll or exe. I set a breakpoint at main, when a client connects to my process, and after that client is sent data. There are thousands of calls to new in between. Each time I click 'Take Snapshot'. When I click take snapshot, a row appears with time, Allocations, and Heap Size. The latter two are zeroed out.


如果我对我的单元测试做同样的事情,它们已填写完毕,我可以按照文档中的描述向下钻取。

If I do the same with my one of my unit tests, they are filled out and I can drill down as described in the documentation.


我应该寻找什么来获取它与我的主项目合作?是否有某些链接设置?我正在构建静态库和动态库是否重要?有什么具体要找?

What should I look for to get it to work with my main project? Are there certain linking settings? Does it matter that I am building statics libs and dynamic libs? Anything specific to to look for?

推荐答案

嗨克里斯托弗,

Hi Christopher,

感谢你的发帖。

但可以在你身边重现这个吗?我的意思是你可以尝试创建一个全新的项目,看看。

But could reproduce this in you side? I mean you can try to create a brand new project and see.

在VS2017和VS2015中都可以正常使用。以前有类似的问题报道:

It works fine both in my VS2017 and VS2015. The similar issue has ben reported before:

https://developercommunity.visualstudio.com/content/problem/71405/diagnostic-tools-takes-empty-heap-snaphots.html

请让我们知道这可以转载。

Please let us know this could be reproduced.

如果这也发生在所有其他项目中,我建议你修复你的VS2015。

If this happened to all the other projects as well, I suggest you repair your VS2015.

 

祝你好运,

Fletcher


这篇关于Visual Studio诊断 - 内存使用情况快照显示0分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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