run-time errors and memory leaks detection

August's Avatar, Join Date: Nov 2010
Light Poster
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++?
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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?
August's Avatar, Join Date: Nov 2010
Light Poster
Yeah. Looks like I've found a decision - Deleaker
StarDrago's Avatar, Join Date: Nov 2011
Go4Expert Member
Quote:
Originally Posted by August View Post
Yeah. Looks like I've found a decision - Deleaker
Good debugger! I use it for search GDI and memory leaks