Answered by:
Visual Studio Memory leak detection mechanism

Question
-
Does Visual Studio 2010 has a memory leak detection tool? In Visualizer I found memory profiler but not memory leak detection tool?
Saturday, April 17, 2010 1:19 AM
Answers
-
Hi SMNW,
Thanks for your post.
Visual Studio debugger and C run-time libraries provide you effective means for detecting and identifying memory leak. To understand how to do it, please refer to the MSDN article: http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx. (There is no new feature in VS 2010)
Other than Visual Studio, there are other tools that you can use to detect memory leak in native code:
Umdhtools.exe: How to use Umdh.exe to find memory leaks
There is a sample along with a detailed ReadMe file about how to detect handle and memorty leak at All-In-One Code Framework. You'd better take a look of it.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
See what's happening in MSDN forum? Follow us at Twitter.- Marked as answer by Hongye Sun - MSFT Wednesday, May 5, 2010 2:52 AM
Monday, April 19, 2010 5:52 AM -
Hello,
I am writing to follow up this issue. Would you mind updating me the issue status? Thanks.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
See what's happening in MSDN forum? Follow us at Twitter.- Marked as answer by SMNW Monday, May 10, 2010 7:13 PM
Wednesday, April 21, 2010 8:41 AM
All replies
-
Hi SMNW,
Thanks for your post.
Visual Studio debugger and C run-time libraries provide you effective means for detecting and identifying memory leak. To understand how to do it, please refer to the MSDN article: http://msdn.microsoft.com/en-us/library/x98tx3cf.aspx. (There is no new feature in VS 2010)
Other than Visual Studio, there are other tools that you can use to detect memory leak in native code:
Umdhtools.exe: How to use Umdh.exe to find memory leaks
There is a sample along with a detailed ReadMe file about how to detect handle and memorty leak at All-In-One Code Framework. You'd better take a look of it.
Hope it helps.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
See what's happening in MSDN forum? Follow us at Twitter.- Marked as answer by Hongye Sun - MSFT Wednesday, May 5, 2010 2:52 AM
Monday, April 19, 2010 5:52 AM -
Hello,
I am writing to follow up this issue. Would you mind updating me the issue status? Thanks.
Hongye Sun [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
See what's happening in MSDN forum? Follow us at Twitter.- Marked as answer by SMNW Monday, May 10, 2010 7:13 PM
Wednesday, April 21, 2010 8:41 AM -
The memory leak information is printed on "Output" window.[ This advantage is in "Debug" mode only. ]Example
int _tmain(){int* ptr = NULL;ptr = (int*)malloc(sizeof(int)*20);for( int i=0; i<20; ++i )ptr[i] = i;#ifndef NDEBUGint flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); // Get current flagflag |= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit_CrtSetDbgFlag(flag); // Set flag to the new value#endif//free(ptr);printf("\n\nPress Enter...");getch();return 0;}
Cheers, ElizaTuesday, May 4, 2010 9:09 AM