Question

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.

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.

Was it helpful?

Solution

Checkpoint based memory usage is built in to the debug CRT libraries in Visual C++.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top