Valgrind Saves Time

Coding in C / C++ with all its advantages, brings along with it, its own demons. The big devil whom you will encounter at most times grinning from ear to ear is Memory Management. These can crop up at the most unexpected places and the worst of the bugs are the ones related to heap management which don’t reproduce easily. They might show up sometimes, but at other times the program will run fine. One way is to have an extensive unit testing plan to catch these errors. Another way is to use memory management tools like Valgrind which pinpoint any Invalid writes, memory leaks, dangling pointers etc. It might be a really good practice to valgrind your program as you unit test your code. Consider the example below which was written an year ago minutes before sleep hit me :

Continue reading

Advertisements