run-time errors and memory leaks detection

Discussion in 'C' started by August, Nov 10, 2010.

  1. August

    August New Member

    Joined:
    Nov 10, 2010
    Messages:
    14
    Likes Received:
    2
    Trophy Points:
    0
    Hi!

    Created application is working toooo slow, looks like there are a lot of memory leaks, there are a lot of pointers. So, please, can you advice some effective tool for run-time errors and memory leaks detection in Visual Studio C++?
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    There's no substitute for a skilled programmer going carefully through the code and fixing the problems. You can use stuff like valgrind but the problem with these tools is that people put too much faith in them, for some reason they think valgrind can solve all their coding problems and make them a cup of tea while they're waiting. Maybe that's the ideal that the valgrind programmers are working towards but automated tools at present can't find stuff that a skilled programmer can't find quickly anyway, and you still need that skilled programmer to look for the more tricky bugs.

    The best solution to memory leaks is not to create them in the first place: whenever you write "new", write "delete" somewhere, even if just to cause a compiler error so that you can't continue until you have placed that delete. Same with malloc and co, write "free" somewhere and don't go onto the next task until you've sorted out that free. Try to allocate and free resources within the same function.

    Memory leaks and pointers in themselves don't cause code to run slowly though. Probably the algorithms themselves need looking at. Have you tried code profiling?
     
  3. August

    August New Member

    Joined:
    Nov 10, 2010
    Messages:
    14
    Likes Received:
    2
    Trophy Points:
    0
    Yeah. Looks like I've found a decision - Deleaker
     
  4. StarDrago

    StarDrago Member

    Joined:
    Nov 12, 2011
    Messages:
    51
    Likes Received:
    3
    Trophy Points:
    8
    Good debugger! I use it for search GDI and memory leaks:cuss::crazy:
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice