All Questions
Tagged with memory-leak c
14 questions
2
votes
2
answers
49
views
How to properly free memory in the following W3Schools c programming code demonstrating Queue Implementation using Linked Lists
I am taking CS50x I am currently on week 5 DataStructures. I am also in the process of going through the W3Schools tutorial on DataStructures for extra practice and to get a better understanding of ...
1
vote
1
answer
25
views
PSET 5 Speller fails memory check
This is the full code:
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h&...
1
vote
2
answers
32
views
PSET 5 speller fails when solving a memory issue
Ok so when I compile the commented out part, check50 fails most of my criteria! But if I remove it, the program works but Valgrind has a frown. But when i run valgrind without the commented code, it ...
1
vote
2
answers
38
views
My load function is licking memory
the program complies properly but when i use valgrind shows am leaking memory when I open the file in the FILE *file = fopen(dictionary, "r");
bool load(const char *dictionary)
{
// TODO
...
0
votes
0
answers
109
views
Recover Assignment Memory Leak and Insufficient Recovery
I am trying to complete the assignment given by CS50x (Harvard Community Online, edX.org), and while it successfully recovers images, valgrind is telling me that there are memory leaks that happen in ...
0
votes
1
answer
100
views
PSET5 speller memory leak and dictionary not unloaded
I have been looking at this for about 5 days now and I can´t find where I am leaking memory or if I have any problems with my code logic. Everything compiles and Valgrind output is below. I am ...
0
votes
1
answer
491
views
valgrind memory leak on speller linked list..."blocks are definitely lost..."
I'm working on my memory leaks for the load() function. Valgrind give me the following error message
==1675== HEAP SUMMARY:
==1675== in use at exit: 8,011,640 bytes in 143,065 blocks
==1675== ...
1
vote
2
answers
9k
views
speller valgrind "uninitialized error was created by heap allocation"
I'm running valgrind on my speller for a hashtable. One of the errors I get, I'm not sure I understand is
uninitialised value was created by a heap allocation
==3079== Uninitialised value was ...
0
votes
1
answer
56
views
Help with unloading my dic
I have been trying speller for far too long now and need help with unloading the dictionary.
This is the code I have now
// Unloads dictionary from memory, returning true if successful else false
bool ...
0
votes
1
answer
187
views
Speller hash table - unload memory not working
Good afternoon
Hitting the last hurdle with unloading memory, can't figure where I'm going wrong
Code to load the hash table:
// Loads dictionary into memory, returning true if successful else false
...
0
votes
1
answer
85
views
Speller - Memory allocation
I'm finishing up speller with a hashtable, but Valgrind is giving me two different headaches.
One of them has to do with this famous 32 bytes, which apparently is some kind of clang bug so I'll ignore ...
0
votes
1
answer
14
views
How can I ensure I'm changing the reference, not a copy, in this C function?
I'm trying to assign a pointer to a pointer within a function. I've passed pointers in and I'm trying to make the change inside. It is not happening, however. The issue is regarding the insert ...
0
votes
1
answer
217
views
Pset5 Memory leak and errors in valgrind
I have been beating my head against a wall trying to solve my issues on my own, but I have gotten no where. I have two issues: 1) I have a small memory leak of 568 bytes in 1 block. My unload function ...
0
votes
1
answer
2k
views
char* and read-only memory
Take a function that creates a char* and does something with it.
void print_hello_twice()
{
char* hello = "hello";
printf(hello);
printf(hello);
}
This is a silly pointles example, but I ...