简体   繁体   English

是否有任何工具支持C ++的基于检查点的内存使用情况分析

[英]Is there any tool that supports checkpoint based memory usage profiling for C++

I am working on a network based application. 我正在基于网络的应用程序上工作。 I want to see the memory usage between different stages of my application, like memory usage between initialization and release or memory usage between send and receive. 我想查看应用程序不同阶段之间的内存使用情况,例如初始化和发布之间的内存使用情况或发送和接收之间的内存使用情况。 I have googled and try to find a solution but no post that exactly matches my requirements. 我已经用谷歌搜索并尝试找到一种解决方案,但没有完全符合我要求的帖子。

Please, you guys, can suggest any tool or process that can help me to perform checkpoint based memory profiling both in Linux and Windows platform. 大家,请提出可以帮助我在Linux和Windows平台上执行基于检查点的内存配置文件的任何工具或过程。

Thanks in advance 提前致谢


The following code 以下代码

_CrtMemState memState1;
_CrtMemCheckpoint(&memState1);

char *p = new char[100];
p = new char[100];
p = new char[100];
p = new char[100];
p = new char[100];

_CrtMemState memState2;
_CrtMemCheckpoint(&memState2);
_CrtMemState memStateDiff;
_CrtMemDifference(&memStateDiff, &memState1, &memState2);
_CrtMemDumpStatistics(&memStateDiff);'

gives me output 给我输出

0 bytes in 0 Free Blocks.
0 bytes in 0 Normal Blocks.
0 bytes in 0 CRT Blocks.
0 bytes in 0 Ignore Blocks.
0 bytes in 0 Client Blocks.
Largest number used: 0 bytes.
Total allocations: 0 bytes.

I am using Visual Studio 2010 Professional on Windows 7 Ultimate. 我在Windows 7 Ultimate上使用Visual Studio 2010 Professional。

Checkpoint based memory usage is built in to the debug CRT libraries in Visual C++. 基于检查点的内存使用情况已内置到Visual C ++的调试CRT库中。

http://msdn.microsoft.com/en-us/library/974tc9t1(v=vs.80).aspx http://msdn.microsoft.com/en-us/library/974tc9t1(v=vs.80).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM