Memory analyzer
-
Hi,
you can use
@#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <iomanip>
#include <sstream>
#include <string>
#include <stdlib.h>
#include <math.h>@
@
std::ostringstream stremString;
std::string resultString;
DWORDLONG physMemUsed;
MEMORYSTATUSEX statusExe;
statusExe.dwLength=sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&statusExe);
physMemUsed = statusExe.ullTotalPhys - statusExe.ullAvailPhys;
stremString<<" Total Memory " <<(float)(physMemUsed/(1024*1024))<<" Mb ";
resultString=stremString.str();
stremString.str("");
@
I used it int my a project. This part of the code. You can take something that. -
If you are in Visual Studio, then VLD (Visual Leaks Detector) works great:
http://vld.codeplex.com/In contrast to the above code, VLD gives you a call stack for each allocation that caused a memory leak.
And it's free :-)
--
Other than that, I have used BoundsChecker and Insure++ at work. But they are not cheap ;-)
And on Linux you always have Valgrind...