Click to See Complete Forum and Search --> : Please suggest a C++ source code analysis tool for debugging
Michael_24
04-22-2008, 02:45 AM
Hi... we are providing software support for one of the famous retailers in U.S. The code has been written in C++. Our field test customers feel that the application software is very slow.
Before we deliver the software to our clients, we are in a urge to improve the performance of the application. Some of our software engineers suspect that the memory dirty pages are too high in the application. They feel that the code have lot of memory leaks. Are there ways to improve the performance of the software?? Is there any tool that finds us the memory leaks in the code? Please suggest?
andrew godwin
04-22-2008, 02:57 AM
Hi, typically, a memory leak occurs because dynamically allocated memory has become unreachable. You can prevent memory leaks by watching for some common problems. Collection classes, such as hash tables and vectors, are common places to find the cause of a memory leak. This is particularly true if the class has been declared static and exists for the life of the application. . The prevalence of memory leak bugs has led to the development of a number of debugging tools to detect unreachable memory. ******** Prevent is one of the tool that you can use for fixing these kinds of bugs. ******** Prevent is also used by the Department of Homeland security to scan many open source projects. You can get more info at http://www.********.com
Danny
04-22-2008, 03:16 AM
Memory leaks have little to do with the application's speed. If the application is always slow (i.e., there is no gradual deterioration pattern after a few hours of running the app), the bottleneck lies elsewhere. There could be other memory related issues, and there could well be leaks that need to be fixed but that's besides the main issue of speed. You need to use a professional profiler, not just a debugger, to detect bottlenecks. I have to tell you that the best thing to do is invest in a professional profiling tool (sorry, I can't recommend commercial products here) because programmers' intuitions about bottlenecks are always way off, to say the least. You should also use a through code review process before anything else. There are bugs that can be detected quite easily simply by looking at the code. Other bugs will probably require the aid of a professional debugger. Finally, the performance bottleneck will need to be addresses as well. These are very general recommendation of course. Without seeing the actual code and testing it, you won't get a more pinpointed lead.
jonnin
04-22-2008, 08:28 AM
first, if you are leaking memory, prove it and fix it. You can prove it by simply watching the program over a long time with OS tools like the windows task manager or unix "top". If the app just keeps getting more and more memory and never seems to reach a peak usage, you probably have a leak (esp. if you are not adding data into the app to feed a growing data structure, etc).
You may have to exercise the program by hand or with a driver program to get the leaks (or any bugs, for that matter) to show up.
------------
Once you are happy with the debugging and leak fixing (and, a leak is a bug), you can tune for speed. Find the top 5 slowest functions per iteration and the top 5 most called functions per "unit of time". Tweak those to be faster and maybe, called less often if possible. Repeat until performance on a target machine is acceptable. Tweaking is the hard part, you may have to do some ugly things like in-line assembly, and occasionaly, global variables or a space to time tradeoff (verify that this is actually better, page faults are awful). Sometimes, its just a silly, very blatent problem like a poor algorithm choice in a tight loop (bubble sort for example).
Peter_APIIT
04-23-2008, 05:39 AM
Try valgrind or IBM Rational Purify Plus. There are many memory leak detection software out there.
I will suggest using IBM software because it comes with performance analysis tool.
devx.com
Copyright Internet.com Inc. All Rights Reserved