在Visual Studio 2013中查找内存泄漏 [英] Finding Memory leaks in Visual Studio 2013

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

问题描述

我正在使用Visual Studio 2013,并参加了C编程课程,我们开始谈论内存错误检测,尤其是内存泄漏,以及如何在Linux上使用Valgrind检测它们.

I am using Visual Studio 2013, and taking a course in C programming and we started talking about memory bugs detaction, in particular memory leaks, and how to detect them using Valgrind on Linux.

我想知道是否有一种方法可以使用VS 2013检测到此类内存泄漏.我尝试在线搜索,但它只会导致大量文章和博客以及msdn帖子和博客,其中包含诸如转储文件之类的大量词语,并进行分析他们,等等,这很奇怪,因为:

I want to know if there is a way to detect such memory leaks using VS 2013. I tried searching online but it just leads to lots of articles and blogs and msdn posts and blogs with lots of words like dump files, and analizing them, etc which weird because:

1)听起来是如此复杂,令人费解并且不直观,实际上很难理解它.

1) It sounds so complex, convoluted and unintuitive it is actually hard to comprehend it.

2)这之所以很奇怪,主要是因为VS是周围最先进的IDE,而Microsoft花费了很多钱,但据我所读,似乎没有简单的方法可以使用VS检测内存泄漏 -当然没有像Valgrind那样简单的方法,我只需要编译程序并运行命令valgrind -leaks-check = yes  ProgramName ,它只是向我显示它认为存在内存泄漏的所有位置并描述该错误(例如,在使用malloc分配内存后不释放内存,因此在程序完成后拥有死"内存,或者访问已用完的内存)的 数组边界)             nbsp; bsp ;              nbsp; b ;              nbsp; b ;              nbsp; b ;              nbsp; b ;              nbsp; b ;                             因此,我的问题是如何使用VS 2013来获得相同的结果,并首先在程序中高层确定是否存在内存泄漏,其次是-以简单的方式检测那些泄漏在哪里-最好不涉及转储文件 (不是我知道如何在VS中使用它们).

2) The main reason this is weird is due to the fact that VS is the most advanced IDE around and Microsoft spends so much money on in, yet from what I have read it seems that there is no simple way to use VS to detect memory leaks - certainly no way that's as simple as Valgrind where I only have to compile the program and run the command valgrind -leaks-check=yes ProgramName and it simply prints to me all location it thinks there is a memory leak and describes the error (like not freeing memory after allocating it with malloc hence having "dead" memory after the program finishes, or accessing memory that's out of the array bounds)                                                                                                                                                                So my question is how to use VS 2013 in order to achieve the same results and to find out First in high level if there are memory leaks in the program, and second - to detect in a simple manner where those leaks are- preferably without involving dump files (not that I know how to use them anyway in VS).

推荐答案

不是我所说的直观或简单的-这就是为什么我在Linux上专门描述了valgrind的简单性-是否有一个简单的命令,或者可视化工具,用于显示程序完成/执行后(逐步调试) 内存泄漏的地方?
Than's not what I would call intuitive or simple - that's why I specifically described the simplicity of valgrind on Linux - is there a simple command, or a visual tool to show after the program is done/during (ala step by step debug) the execution the places with memory leaks?


这篇关于在Visual Studio 2013中查找内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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