VS2010 分析仪/泄漏检测

发布于 2024-08-29 01:18:59 字数 356 浏览 2 评论 0原文

有人知道可以与 VS2010 代码一起使用的分析器和泄漏检测器吗?最好是Win7下运行的。

我在这里和谷歌搜索过。我发现了一种有效的检漏仪(内存验证器),但我并没有太印象深刻。一方面,它显示了一堆菜单泄漏和我相当有信心的东西不是真实的。我也尝试过 GlowCode,但它只是一个分析器,拒绝在 win7 上安装。

我以前用过AQtime。它拥有我需要的一切,内存/资源泄漏检测、分析各种事物、静态分析等。不幸的是,它现在给出了虚假结果。

我面临的主要问题是 VS2010 说某个程序存在泄漏,而 VS2005 中没有泄漏。我几乎可以肯定这是误报,但我似乎找不到一个好的工具来验证这一点。内存验证器没有显示相同的内容,并且 VS 的泄漏报告似乎不合理。

Anyone know of a profiler and leak detector that will work with VS2010 code? Preferably one that runs on Win7.

I've searched here and in google. I've found one leak detector that works (Memory Validator) but I'm not too impressed. For one thing it shows a bunch of menu leaks and stuff which I'm fairly confident are not real. I also tried GlowCode but it's JUST a profiler and refuses to install on win7.

I used to use AQtime. It had everything I needed, memory/resource leak detection, profiling various things, static analysis, etc. Unfortunately it gives bogus results now.

My main immediate issue is that VS2010 is saying there are leaks in a program that had none in VS2005. I'm almost certain it's false positives but I can't seem to find a good tool to verify this. Memory Validator doesn't show the same ones and the reporting of leaks from VS doesn't seem rational.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

蓝色星空 2024-09-05 01:18:59

要查找内存泄漏,您可以尝试视觉泄漏检测工具。

For finding memory leaks you can try Visual Leak Detection tool.

凡尘雨 2024-09-05 01:18:59

Noah,正如 Ori 提到的,Micro Focus 的 DevPartner Studio 具有泄漏检测和其他运行时分析功能。与 Compuware 下 DPS 的高价不同,您现在可以仅许可运行时分析器,而不是整个套件(如果您需要的话)。无耻插件:我在 DevPartner 团队工作。我们的 64 位应用程序支持在 2011 年 2 月 4 日发布的 10.5 版本中提供。请在 http:// www.DevPartner.com

Noah, as Ori mentioned, DevPartner Studio from Micro Focus has both leak detection and other runtime profiling features. Unlike the lofty prices DPS had under Compuware, you can now license just the runtime profilers and not the whole suite if that's what you need. Shameless plug: I work on the DevPartner team. Our 64-bit application support ships in the 10.5 release on February 4, 2011. Look for release news and eval downloads on http://www.DevPartner.com.

゛清羽墨安 2024-09-05 01:18:59

就我个人而言,我喜欢 DevPartner。如果您在一家大公司工作,也许您可​​以说服他们支付巨额许可证费用。它很贵,但是非常非常坚固。

Personally, I'm fond of DevPartner. If you work in a big company, maybe you can convince them to pay for the hefty license. It's expensive, but it's very very sturdy.

墨小墨 2024-09-05 01:18:59

我使用了几种商业替代方案,尽管它们可以提供出色的结果,但它们也经常因为未知的原因而无法工作:

  • Rational Quantity:用于性能分析的出色产品,但它们在几年内未能发布新版本,而且经常(在我的研究中)案例)该软件经常拒绝工作
  • AQTime:也非常好(低于 Rational Quantity),但有时也会因未知原因而拒绝工作。
  • 性能验证器:相同

在过去的几年里,我又回到了对应用程序进行采样的相当粗略的方式。这不像使用仪器那样完美,但它速度更快,可以在任何应用程序上运行并且始终有效。我最喜欢的是“非常困”(http://www.codersnotes.com/sleepy),但也Luke StackWalker (http://lukestackwalker.sourceforge.net/) 相当不错。由于应用程序可以立即运行并且不会出现明显的速度减慢,因此“更改应用程序、配置文件”循环非常短且高效。

为了查找内存泄漏,您可以使用 Windows 中的多种工具。同样,它们远非完美,并且通常只能从外部调查正在运行的应用程序,而不是简单地在应用程序结束时报告泄漏。查找“Microsoft 调试工具”(UMDH、LeakDiag、gflags)。就我个人而言,我发现编写自己的内存管理器并让它在应用程序结束时报告泄漏要容易得多。写起来并不难。你要做的是:

  • 实现正确的new和delete运算符(我认为你应该实现4个new和4个delete运算符)
  • 在new的实现中,获取调用堆栈(查找StackWalk)并将其与分配的内存一起存储。
  • 创建一个在构造函数中启动内存管理器的类,并在析构函数中报告所有泄漏(包括调用堆栈)。
  • 创建该类类型的全局变量。可能需要使用#pragma(init_seg) 将其设为特殊的全局变量。

I used several commercial alternatives and although they can deliver fantastic results, they also often simply fail to work because of unknown reasons:

  • Rational Quantity: fantastic product for performance profiling, but they failed to release new versions during several years, and often (in my case) the software often refused to work
  • AQTime: also very good (less than Rational Quantity) but also sometimes refuses to work for unknown reasons.
  • Performance validator: same

In the last years I returned to the rather crude way of sampling the application. This is not as perfect as using instrumentation, but it's much faster, can be run on any application and always works. My favorite is "Very Sleepy" (http://www.codersnotes.com/sleepy) but also Luke StackWalker (http://lukestackwalker.sourceforge.net/) is quite good. Because the applications can be run immediately and without a noticeable slowdown, the "change app, profile" loop is very short and efficient.

For finding memory leaks, there are several tools in Windows that you can use. Again, they are far from perfect, and often can only investigate running applications from the outside, not simply reporting leaks at the end of the application. Look for the "Microsoft Debugging Tools" (UMDH, LeakDiag, gflags). Personally, I find it much easier just to write my own memory manager, and let it report the leaks at the end of the application. It's not that hard to write. What you have to do is:

  • Implement the correct new and delete operators (I think you should implement 4 new and 4 delete operators)
  • In the implementation of new, get the call stack (look for StackWalk) and store this with the allocated memory.
  • Make a class that starts your memory manager in the constructor, and report all the leaks (including the call stack) in the destructor.
  • Make a global variable of that class-type. It might be needed to make it a special global variable using a #pragma(init_seg).
倚栏听风 2024-09-05 01:18:59

这里也有非常简单易用的泄漏检测代码: http://www.codeproject .com/kb/cpp/MemLeakDetect.aspx

There's really simple and easy to use Leak Detection code here too: http://www.codeproject.com/kb/cpp/MemLeakDetect.aspx

萌面超妹 2024-09-05 01:18:59

不知道如何链接到这个,我之前发布过类似的问题:

您可以使用 umdh.exe 捕获并比较泄漏发生之前和之后的进程快照。这对于调试二进制文件效果最好,但对于发布版本也可行,前提是符号路径设置正确 - 它将为您提供在第一个和第二个快照之间分配的内存的调用堆栈。

http://support.microsoft.com/kb/268343

这种方法的优点是自由的。

Not sure how to link to this, which I previously posted in response to a similar question:

You can use umdh.exe to capture and compare snapshots of the process before and after leak happens. This works best with Debug binaries but is viable with Release provided symbol paths are correctly set - it will give you the callstacks of memory allocated between the 1st and the 2nd snapshot.

http://support.microsoft.com/kb/268343

This approach has the advantage of being free.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文