Having trouble enabling "full" memory leak reporting in Visual Studio 2010

질문 Having trouble enabling "full" memory leak reporting in Visual Studio 2010

  • Monday, January 28, 2013 5:02 PM
     
     

    Hello,

    I performed a search on the internet, as well as in these forums, but couldn't find an answer to my questions.  I have two questions regarding enabling memory leak reporting in Visual Studio 2010:

    I am currently using Visual Studio 2010 for developing a professional C++ application.  Currently, we have memory leaks reported in the "Output" window.  The memory leak report is similar to the following:

    Detected memory leaks!
    Dumping objects ->
    {18} normal block at 0x00780E80, 64 bytes long.
     Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
    Object dump complete.

    I am interested in configuring Visual Studio 2010 to print out "full" memory leak information, such that the report includes the file name and line number where each memory leak occurred.  I found the following guide:

    http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.100%29.aspx

    Before I made any changes to my project, I saw that the project contained some of the code identified in the above guide.  I followed the steps in the guide to insert the rest of the required code, but I am still not able to get the file name and line number to display in the memory leak report.  I am still only getting basic information to display in the report, similar to what I pasted above.

    Question #1:  are there additional steps that I need to perform to display the file name and line numbers in my memory leak report?

    I also investigated another code project of ours, and saw that the memory leak reports from that project do in fact include file and line numbers.  But, none of the code that is specified in the above article exists in that project.  Therefore, it appears that a programmer before me somehow enabled memory leak reporting without using the methods described above.

    Question #2:  Is there an alternative method for enabling the "full" memory leak reporting in the Visual Studio 2010 "Output" window, other than what is described in the above article?

    Thanks in advance.

All Replies

  • Wednesday, January 30, 2013 3:37 AM
    Moderator
     
     

    Hi keltor83,

    Like this document provided by you. Whether your app defines _CRTDBG_MAP_ALLOC?  If not, it will no show the memory allocation number and the file name.

    Question #2:  Is there an alternative method for enabling the "full" memory leak reporting in the Visual Studio 2010 "Output" window, other than what is described in the above article?

    About the second issue, sorry for that I didn’t find other solution, but as far as I know, we could collect the memory information with other tools, like the Profiler or others. Anyway, you could submit this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. You can send your idea/suggestion there and people can vote. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Friday, February 08, 2013 10:49 PM
     
     

    Hello Jack,

    Thank you for your reply and your suggestions.  As mentioned in the guides that you and I have linked, I have defined  _CRTDBG_MAP_ALLOC in my project.  I also followed the rest of the information in both guides, but am still not seeing file names and line numbers in the memory leak report.

    Do you have any other suggestions on making this work?

    To clarify Question #2:  I found another project in our code library that does not define  _CRTDBG_MAP_ALLOC or contain any of the declarations mentioned in the guide, but I do see file names and line numbers in the memory leak report.  Do other methods exist to enable reporting of file names and line numbers in the memory leak report, besides what is described in the guide I linked above?  I'm not requesting a new feature; rather, I'm trying to understand how this feature is working in another project of ours when it doesn't follow the steps listed in the guide.

    Thank you.


    • Edited by keltor83 Friday, February 08, 2013 10:51 PM additional details
    •  
  • Thursday, February 21, 2013 9:25 AM
    Moderator
     
     

    Hi keltor83,

    Sorry for delay about this issue.

    To help you resolve this issue, would you mind sharing us the simple sample? I will try to check it in my machine, so we could make sure that whether it is related to the APP or the VS.

    Please also attach your Visual Studio project, you can upload it to the sky drive, and then share the download link in your post. Please also attach a screenshot image in your post. Or you could send your project to jackzhai at Hotmail dot com.

    If there's any concern, please feel free to let me know.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Tuesday, March 05, 2013 8:17 PM
     
     

    Hello Jack,

    I will inquire with my supervisor if he will allow me to provide you with our code project.  Since the code project I am inquiring about is part of our commercial software, he may not agree to me uploading the code project to you.

    Since your last reply, I have done some additional research into the problem.  I realized that the project I am working on (the one that doesn't print filenames and line numbers for memory leaks) is a Win32 project, not MFC.  The other project that I mentioned (the one that does print filenames and line numbers for memory leaks) is a MFC project.

    Does the printing of filenames and line numbers for memory leak reports only work with MFC?  Is it possible to enable this feature for Win32 projects?  If so, can you please provide a list of recommended steps?

    Thank you very much for your assistance.