visual-studio 如何在 Visual Studio 2010 中分析程序的内存使用情况?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4213323/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:47:11  来源:igfitidea点击:

How to analyse program's memory usage in Visual Studio 2010?

visual-studiomemory-management

提问by Ying Chan

Is there a way to check what memory has been allocated to in a program coded in VS 2010? I've been noticing that a recent program I've been making keeps using more and more memory over time without releasing any.

有没有办法检查在 VS 2010 中编码的程序中分配了哪些内存?我一直注意到我最近制作的一个程序随着时间的推移不断使用越来越多的内存而没有释放任何内存。

Also, are there any articles on code design that teaches you good memory management? I seem to be searching the wrong terms on google as I keep getting useless results.

另外,是否有任何关于代码设计的文章可以教您良好的内存管理?我似乎在 google 上搜索错误的术语,因为我不断得到无用的结果。

回答by Daniel Rose

There are commercial tools such as ANTS Memory Profileror .NET Memory Profileror dotTrace. Secondly, take a look at this MSDN article. Lastly, Maoni Stephens has many blog posts on garbage collection and memory management in .NET. They are all linked here.

有一些商业工具,例如ANTS Memory Profiler.NET Memory ProfilerdotTrace。其次,看看这篇 MSDN 文章。最后,Maoni Stephens 发表了许多关于 .NET 中的垃圾收集和内存管理的博客文章。他们都在这里链接。