Using Valgrind Tool – Part 1

 Valgrind Tool Introduction

So what is Valgrind ? It may be possible that at the time of reading this post, you may have basic familiarity with Valgrind or vice-versa. So lets understand the basic purpose of Valgrind before diving deeper into the topic.  In the very naive language, it can be described as a tool used for memory debugging and code profiling  . The different purposes for which this tool can be used for memory debugging are listed below :

  • Indicates wherever uninitialized memory is used in the code.
  • depicts where read/write operation is being performed after freeing the memory block
  • depicts whenever code tries to write outside the memory block allocated by malloc
  • highlights the memory leaks in the code
  • highlights when code tries to access the inappropriate areas on the stack

Give example of how to use it in code…

=> where try is an executable file for which you need to perform memory debugging.

But now Valgrind is much more than a simple profiler tools as it has evolved as an infrastructure for code profiling and memory debugging offering different  techniques to catch serious issues which can break your code in real time execution. Different tools which are being offered to Valgrind users are listed below :

  • Memcheck –  This provides the facility for debugging memory management related errors in the code. So its kinda memory profiler
  • CacheCheck – This is a cache profiler
  • Callgrind – It provides all the information that cachecheck provides plus the extra information of Call Graph.
  • Massif – This is a heap profiler.
  • Helgrind – This tool is used to detect data race conditions for multi threaded programs
  • DRD – DRD is a tool for identifying errors in multi-threaded C /C++ programs

So how does this tool detects all this stuff prematurely. Basically , tools like valgrind executes your executable in the simulated environment in which memory allocations are much more controlled and guarded as compared to our real time run environment. So these tools provides this extra disciplined simulated run environment against which they test our executable and at the same time, catch different error in our executable which results in breakage during execution based upon the different parameters for which user wants his executable to be tested.

I know this is a very brief description about an interesting tool like  valgrind and its related tools. So, we will talk about Valgrind and its related tools in detail in next part.. Till then See you guys.. Keep debugging !!!

You can download Valgrind tool from this Link

Author’s Note :  Hey Guys!!! Currently I am not sure what and how much data is to provided in the posts to keep it brief and at the same make it useful for your use. So please help me improvising to make this and other posts (basically the whole stuff) more useful and interesting for you guys… Thanks in Advance !!!

Share Button



  1. Your style is really unique compared to other people I
    have read stuff from. I appreciate you for posting when you’ve got the opportunity, Guess
    I’ll just bookmark this web site.

  2. Hi, I do think this is a great blog. I stumbledupon it 😉 I will return yet again since i have book marked it. Money and freedom is the best way to change, may you be rich and continue to help other people.|

  3. Elevator pitch helps !

    If you can make a 30 seconds sales pitch for your article then it should be posted.
    It can be 2 to 3 lines executive summary in the beginning of the article. What new/interesting/hidden/obscure thing that you want to explain in 2 lines? If you are convinced with your executive summary its worth a page of writing/reading.

  4. You made some decent points there. I looked on the net for the dilemma and found most individuals will go
    along with with your site.

  5. The next time I read a blog, I hope that it doesnt disappoint me as much as this one.
    I mean, I understand it was my choice to read, but I actually thought youd have something interesting to say.
    All I hear is a bunch of whining about something that you could fix if you werent overly busy looking for attention.

Leave a Reply

Your email address will not be published.