C ++(windows)中的分配数及其可预测性 [英] Allocation numbers in C++ (windows) and its predictibility

查看:93
本文介绍了C ++(windows)中的分配数及其可预测性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 _CrtDumpMemoryLeaks 来识别我们的软件中的内存泄漏。我们在多线程应用程序中使用第三方库。这个库确实有内存泄漏,因此在我们的测试中,我们想要识别那些我们的并丢弃那些我们没有任何控制权。

I am using _CrtDumpMemoryLeaks to identify memory leaks in our software. We are using a third party library in a multi-threaded application. This library does have memory leaks and therefore in our tests we want to identify those that ours and discard those we do not have any control over.

我们使用连续集成

所以问题是 - 是否有一个安全的方法来识别我们的泄漏和那些泄漏是第三个党图书馆。

So the question is - is there a safe way of identifying those leaks that are ours and those that are the third parties library. We though about using allocation numbers but is that safe?

推荐答案

您可能需要使用 DebugDiag 工具由Microsoft提供。有关工具
的完整信息,请参阅: http ://www.microsoft.com/en-sg/download/details.aspx?id = 40336

You may want to use DebugDiag Tool provided by Microsoft. For complete information about the tool we can refer : http://www.microsoft.com/en-sg/download/details.aspx?id=40336

DebugDiag 可以用于识别各种问题。我们可以按照步骤跟踪
泄漏(我们的和第三方模块):

DebugDiag can be used for identifying various issue. We can follow the steps to track down the leaks(ours and third party module):


  1. 在规则类型下配置DebugDiag Native(non .NET)Memory and Handle Leak。

  2. 现在重新运行应用程序并捕获转储文件。我们还可以配置
    DebugDiag,在指定的间隔后捕获转储文件。

  3. 现在我们可以使用DebugDiag在性能分析器下打开/分析捕获的转储文件。 / li>
  1. Configure the DebugDiag under Rule Type "Native(non .NET) Memory and Handle Leak".
  2. Now Re-run the application for sometime and capture the dump files. We can also configure the DebugDiag to capture the dump file after specified interval.
  3. Now we can open/analyze the captured dump file using DebugDiag under the "Performance Analyzers".

一旦分析完成,DebugDiag会自动生成报告并给出
模块/ DLL信息, (具有概率)。在这之后,我们从DebugDiag工具获得有关模块的信息,我们可以通过静态代码分析集中在那个特定的模块上。如果模块属于第三方DLL,我们可以向他们共享DebugDiag报告。除此之外,如果您运行/附加您的应用程序与适当的PDB文件,DebugDiag也提供了调用堆栈从内存泄漏的机会是可能的。

Once analysis is complete, DebugDiag would automatically generate the report and would give you the modules/DLL information where leak is possible(with probability). After this we get the information about the modules from DebugDiag tool, we can concentrate on that particular module by doing static code analysis. If modules belongs to third party DLL, we can share the DebugDiag report to them. In addition to this, if you run/attach your application with appropriate PDB file, DebugDiag also provides the call stack from where chances of memory leak is possible.

这些信息非常有用在过去同时调试内存泄漏在基于Windows的应用程序。希望以上信息将是有用的。

These information were very useful in the past while debugging memory leak on windows based application. Hopefully above information would be useful.

这篇关于C ++(windows)中的分配数及其可预测性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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