4

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 ;)

2
  • 1
    "i am running everything" - WOW, all at once!? Cool! ;-) Commented Mar 19, 2010 at 9:58
  • Well, if you like it or not, I would suggest getting comfortable with the command line. When I started programming, I was an Windows nerd, and a Linux hater, and refused to use it. But I had to, and once I got the basics, I really appreciated using it. Today I only use Windows for gaming ;-). Commented Mar 19, 2010 at 10:55

6 Answers 6

17

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.

Sign up to request clarification or add additional context in comments.

5 Comments

"It has no GUI, but doesn't need one" -- I beg to differ, especially since the OP specifically confessed to being uncomfortable with the command line. That said, valgrind's the best tool I know of.
i can manage the command line if i no what i am typing i suppose, as long as the commands are not to taxing. I struggle with doing lots of terminal stuff, but if its minimal commands and i can just read the output then that should be ok i guess?
@sbsp: Once you see the kind of detail val-grind produces, you won't mind. :) (It's awesome.)
@ptomato - I've been using Valgrind for about 3 years, and the only two options I know (and need) are those two I gave in my answer. If the OP has at least managed to use GDB (which by the sound of it, they have) then Valgrind will be a piece of cake. I actually use Valgrind for debugging some times :)
If you are using Eclipse, then valgrind can be integrated into the IDE using the Linux Tools module (eclipse.org/linuxtools).
2

Purify is a great application for this.

Comments

1

There's a gui for analyzing valgrind results: http://alleyoop.sourceforge.net/. Besides, there's (non-free) purify which is great, and i believe there's a trial. It has a GUI.


Comments

1

On Windows, HeapMon may be of some interest, although it does not explicitly tell you where are your leaks.

Comments

0

valgrind is pretty good on Linux, but it only has a command line interface

Comments

0

If you're using Microsoft's DevStudio then the C run-time library has plenty of memory allocation tracking tools already built-in:

The Debug Heap

_CrtSetDbgFlag

It amazes me how few programmers seem to be aware of these tools!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.