Thursday, 24 November 2011

Memory Issues : Valgrind and Valkyire

Here come the blog related with Memory management and system management for executable.

Most of the time we are facing issues in c/c++ executable related with the crashes .
the main reason for the crashes are the segmentation fault caused by the address violation by a pointer variable.
Valgrind and Valkyrie is the answer for such situation .

Valgrind:Valgrind is a GPL licensed programming tool for memory debugging, memory leak detection, and profiling

Valgrind is the back end and having command line output which is bit complex to understand.
Valkyrie
Valkyrie is the front end UI tools which ease the understanding .Valyrie is a front-end gui for valgrind v3 and up. It's based on QT, and uses valgrind's xml output to display all the information in a nice tree form. I've started using this as it makes debugging memory problems a heck of a lot easier.

Install Valgrind : use the updated 3.x release in combination of Valgrind 4.x release.

Combine valgrind with valkyrie : Just append the Binary executable with valkyrie keyword with options like
valkyrie --smc-check=none --pointercheck=yes /bin/ls -lF .
one can provide the options using the GUI of Valkyrie options for log files location, format and binary location .

Log files are well defined tree structured . One can save the xml file for ceration scenario. It can be opened and analyzed at any time .

Point to note here : You can get complete code if you run valgrind/valkyrie on Debugged version of binary . Optimized version does not provide the location of error in file .

Valgrind/Valkyrie slow down the process tremendously so one need real patience to get the result .

Enjoy Debugging !!