1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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,012
    Likes Received:
    203
    Trophy Points:
    0
    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 New Member

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

Share This Page