CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2009
    Location
    Bangalore, INDIA
    Posts
    45

    Question How to identify memory leaks?

    Hello,

    I want to check whether memory leaks exists in my prog. I use VS 2008 standard edition. I see that there is an in built debugger which makes life simpler to debug.

    I came across this link

    http://msdn.microsoft.com/en-us/libr...=VS.80%29.aspx

    I followed the steps, but i am not able to get the line number and filename where memory is leaking. Only thing is it is dumping the memory leaks.

    Now my question is whatever it displays, the block of memory, is that full memory leak??

    I mean there are values like,

    00 00 00 02 14 B2 CD 00.......
    or
    .... 00 14 00 CD CD CD CD
    or full of zeros...

    How do i identify which one is having memory leak? Whats the rule to identify based in this data which block is leaking.?

    Suggestions and comments required urgently.

    Thanks

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: How to identify memory leaks?

    Please, show the exact "memory leaks" message, not your own skipped version of it!
    Victor Nijegorodov

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: How to identify memory leaks?

    You can use _CrtDbgBreak in the watch window, to break at the block allocation that generated the leak. But you need to get a reproduceable scenario, with the same allocation numbers generating leaks for each run.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: How to identify memory leaks?

    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: How to identify memory leaks?

    Here is an FAQ about how to find the source of memory leaks: http://www.codeguru.com/forum/showthread.php?t=499952.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured