I'm getting a valgrind memory leak report for CS50's Speller problem.
==28709== LEAK SUMMARY:
==28709== definitely lost: 0 bytes in 0 blocks
==28709== indirectly lost: 0 bytes in 0 blocks
==28709== possibly lost: 0 bytes in 0 blocks
==28709== still reachable: 134,307 bytes in 1,159 blocks
==28709== suppressed: 0 bytes in 0 blocks
I've managed to solve the speller problem but the valgrind problem remains.
I tried debugging my codes but still didn't succeed so I tried to run the original untouched codes, the same exact error with same exact value kept occurring.
I even tried to remove the speller.c content, leaving only an empty main() inside but still the same error.
// Implements a spell-checker
#include <ctype.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/time.h>
#include "dictionary.h"
// Undefine any definitions
#undef calculate
#undef getrusage
// Default dictionary
#define DICTIONARY "dictionaries/large"
// Prototype
int main(int argc, char *argv[])
{
// Success
return 0;
}
// Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include "dictionary.h"
// Represents a node in a hash table
// Number of buckets in hash table
const unsigned int N = 1;
// Returns true if word is in dictionary else false
bool check(const char *word)
{
// TODO
return false;
}
// Hashes word to a number
unsigned int hash(const char *word)
{
// TODO
return 0;
}
// Loads dictionary into memory, returning true if successful else false
bool load(const char *dictionary)
{
// TODO
return true;
}
// Returns number of words in dictionary if loaded else 0 if not yet loaded
unsigned int size(void)
{
// TODO
return 0;
}
// Unloads dictionary from memory, returning true if successful else false
bool unload(void)
{
// TODO
return true;
}
I'm not sure what to do next, any help will be appreciated, thanks.