none
Finding Memory Leak with DebugDiag 1.2 or ?? RRS feed

  • Question

  • Hi,

    I am fairly new to this and have a small application that appears to be leaking. I get an out of memory exception after acquiring data (~60 image captures consistently) from a camera (which includes some analysis). The images are 16-bit 3K x 2K in size. The application contains unsafe code required for speed considerations and does use/require 3rd party non-.NET libraries. I am looking for the next steps to find the memory leak. Due to dependencies it is a 32-bit application.

    Facts:

    - My approach so far has been to use DebugDiag v1.2 with reporting including full dumps and I am using the script MemoryAnalysis.asp for the data analysis. The dumps are started at a stable point (i.e. prior to starting another round of acquiring) and occur while acquiring. I have tried both the performance and native types of rules.

    If you think some specific areas would be of benefit to get more information, just let me know. Any help with this would be appreciated.

    Thanks for looking,

    Buck

    • Moved by Bob Shen Friday, January 25, 2013 6:36 AM
    Wednesday, January 23, 2013 8:56 PM

Answers

  • Hi Buck,

    Welcome to the MSDN Forum.

    Someone asked same question: http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/E0AAEAA5-2F51-498E-999E-B27019AA257B from plodoc:

    You are linking with the optimized C runtime library's malloc which is FPO'ed. Using the debug one will work as you wish.

    /nologo /MTd /W3 /GX /Zi /Od /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/Testcppvc6.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c


    Other ways to find memory leaks can be to use different tools, for instance DebugDiag which injects its own dll in the process to track the leaks. Check the comments initiated by Volker von Einem in the codeproject article you're following. 

    With windbg, this way of searching for leaks will be easy only with big leaks in programs compiled without optimization. Optimized programs or subtle leaks will need more work like looking into the leaked memory to identify it or debugging live to reconstruct the missing stack, or other technics...

    I hope it will be helpful.

    Best regards,


    Mike Feng
    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.

    • Marked as answer by Buck3 Sunday, January 27, 2013 6:53 AM
    Friday, January 25, 2013 7:10 AM
    Moderator

All replies

  • I dont really know any tools for this, but what i usually do is to comment out some sections of code (avoid functinality that i think its cousing it) and let rest run and see if the memory leak is still there. If not comment another section, and so on ... . Pin pointing it can be really hard but a lot of times is just one line.

    Anze Javornik

    Thursday, January 24, 2013 1:11 AM
  • Hi Anze,

    Thanks for the reply! This sounds good but also wondering about a systematic approach that is not brute force. I was hoping DebugDiag would show it. I am interested in a way to verify that my application is not leaking in general (e.g. is there another leak that just needs more acquisitions before an out of memory condition occurs). 

    Thanks again!

    Buck

    Friday, January 25, 2013 3:49 AM
  • Hi Buck,

    Welcome to the MSDN Forum.

    Someone asked same question: http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/E0AAEAA5-2F51-498E-999E-B27019AA257B from plodoc:

    You are linking with the optimized C runtime library's malloc which is FPO'ed. Using the debug one will work as you wish.

    /nologo /MTd /W3 /GX /Zi /Od /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/Testcppvc6.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c


    Other ways to find memory leaks can be to use different tools, for instance DebugDiag which injects its own dll in the process to track the leaks. Check the comments initiated by Volker von Einem in the codeproject article you're following. 

    With windbg, this way of searching for leaks will be easy only with big leaks in programs compiled without optimization. Optimized programs or subtle leaks will need more work like looking into the leaked memory to identify it or debugging live to reconstruct the missing stack, or other technics...

    I hope it will be helpful.

    Best regards,


    Mike Feng
    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.

    • Marked as answer by Buck3 Sunday, January 27, 2013 6:53 AM
    Friday, January 25, 2013 7:10 AM
    Moderator
  • Thanks Mike for the good response!

    Best,

    Buck

    Sunday, January 27, 2013 6:54 AM