I have been implementing my load function and I saw in the lecture that I should use valgrind to check for any possible leaks. However, when I use valgrind with my code, I get an error that says Permission Denied. Is there an issue with my code that is causing this error? Thank you in advance.

My code:

// edited out per academic honesty
  • Is permission denied only when running the program through valgrind? Can you provide a full quote of the message provided?
    – kluvin
    Oct 24 '16 at 19:45
  • @M.Kleiven See edit. Oct 24 '16 at 22:03

You should compile with make speller not make dictionary. There is indeed a dictionary file, the reason you can't run it with ./dictionary however, is because it doesn't contain a main() function, so as far as the compiler is concerned your the dictionary.c file never begins. The functions in dictionary.c is instead called by speller.c, details on where can be found in the specifications.

In conclusion, use make speller to compile, and use ./speller to run (with required arguments of course).

  • Thanks! I still have one question though: how do I check if my load function is working correctly? Oct 24 '16 at 23:33
  • 1
    When I completed my load() function I simply assumed it would work, and then went on to work on check(), when something went wrong during my testing of check() I usually had a good idea of where to look in load() if no issue was found in check(), once I had repeat that enough times I eventually had two working functions. Alternatively you can use GDB and inspect the execution of load() step-by-step, this may take a lot of time but if there's something wrong you should be able to tell quite fast. If going with the latter method I recommend you use the small dictionary, or a custom one.
    – kluvin
    Oct 25 '16 at 7:50
  • Thank you so much! Oct 25 '16 at 11:59

You must log in to answer this question.

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