Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need a tool to detect memory leaks in C code

Is there a good application (that has some kind of gui) for testing memory leaks in c code. I would really like to test my assignment/programme but being very new to this, i struggle with using the terminal to do things, especially using gdb for debugging (to me it feels like a blast from the past, where i could be using some visual debugger).

Thanks for the help

edit: platform doesn't matter - i am running everything ;)

like image 423
sbsp Avatar asked Nov 30 '22 18:11

sbsp


2 Answers

Depending on the platform (you don't mention it) Valgrind is fantastic on Linux systems. It has no GUI, but doesn't need one.

Just run valgrind <path to your application + arguments> and it will run your application and spit out any errors during memory operations.

Add the --leak-check=full and --show-reachable=yes options after valgrind to get stack-traces of where your memory leaks originate.

like image 151
Andy Shellam Avatar answered Dec 15 '22 05:12

Andy Shellam


Purify is a great application for this.

like image 44
mouviciel Avatar answered Dec 15 '22 05:12

mouviciel