Is there a tutorial or link someone might direct me towards to how to use and analyze valgrind to find memory leaks. I've passed Pset4 Speller, but lost points on memory leaks.

I thought it might be in the command line:

valgrind speller

But I get an error on that. What is the correct command line? and any links someone might point me towards on how to use Valgrind?



You'd prepend valgrind to whatever you would usually type. If you use ./speller texts/alice.txt, you would write valgrind ./speller texts/alice.txt instead, similar to how debug50 and other tools are used.

valgrind itself is a pretty powerful tool, and you'll never use most of its functions. The default options should already find most issues you can have in this context. There's official documentation at the valgrind homepage, and searching the internet you'll find some users who think they got some good parameters (placed between valgrind and ./speller), just keep in mind that many of them will make valgrind more verbose (for better or worse).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .