Click here to Skip to main content
14,983,791 members
Articles / General Programming / Debugging
Alternative
Tip/Trick
Posted 26 Jan 2012

Stats

13K views
1 bookmarked

Fast and easy memory leak detection

Rate me:
Please Sign up or sign in to vote.
2.67/5 (3 votes)
26 Jan 2012CPOL
For Visual Studio IDE we can detect leaks by using CRT debugger functions#define _CRTDBG_MAP_ALLOC#include #include void main(){ // ...... // ...... _CrtDumpMemoryLeaks();}This will dump leaks if any to the Output window. Check this link :...
For Visual Studio IDE we can detect leaks by using CRT debugger functions

C++
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>

void main()
{
   // ...... 
  // ......

  _CrtDumpMemoryLeaks();
}</crtdbg.h></stdlib.h>


This will dump leaks if any to the Output window. Check this link : http://msdn.microsoft.com/en-us/library/e5ewb1h3(v=vs.80).aspx[^]

Any way this seems to a nice tool. I will try it for sure. My 5

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Lakamraju Raghuram
Technical Lead
India India
_____________________________________________________________

Did my masters from IIT-M in Advanced Manufacturing Technology and working mainly on C++ in CAD domain from 2004 onwards.
Working on web technologies using Angular 7.0 and above, HTML5, CSS3 from 2015.

Comments and Discussions

 
GeneralMy vote of 1 Pin
Sivaraman Dhamodharan30-Jan-13 19:37
MemberSivaraman Dhamodharan30-Jan-13 19:37 
GeneralRe: My vote of 1 Pin
Lakamraju Raghuram31-Jan-13 1:08
MemberLakamraju Raghuram31-Jan-13 1:08 
GeneralSorry. I am not convinced. Memory leak detection should be d... Pin
Lakamraju Raghuram27-Jan-12 2:14
MemberLakamraju Raghuram27-Jan-12 2:14 
GeneralWill there be any additional leaks in release mode compared ... Pin
Lakamraju Raghuram26-Jan-12 22:21
MemberLakamraju Raghuram26-Jan-12 22:21 
GeneralRe: But you can't check the memory leaks of a release builds wit... Pin
Octopod26-Jan-12 23:08
MemberOctopod26-Jan-12 23:08 
GeneralReason for my vote of 2 Thank you for this hint for who don'... Pin
Octopod26-Jan-12 21:56
MemberOctopod26-Jan-12 21:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.