Debugging Memory leaks in Large applications and libraries in Linux

Memory leaks is a disaster in Embedded Linux Applications.
If leak happens at func1 at file1.c the application may crash in func100 at file10.c.
It very hard to detect and the fix issues due to Memory leaks.
If your application size is of small, it can be easily identified by code review. If there are 100s of
files and 1000s of functions, the best tool is valgrind.
Compile your source with -g option to enable the debugging  symbols and run the application
through valgrind.
ex: valgrind --leak-check=all <myprog> --num-callers=100.

Check the report after complete run and go through invalid writes and correct them..
Thats it!!! which can save huge amount of time spent in source code walkthrough!!!

Comments

  1. if you need any information about valgrind comment here.. i can help you out...

    ReplyDelete

Post a Comment

Popular posts from this blog

Getting backtrace during stack corruption

Analyzing Crash dumps in Linux using GDB

Generate backtrace automatically when program crashes due to SIGSEGV