Questions tagged [memory-leak]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
2 answers
38 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 ...
Dallas Vienneau's user avatar
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&...
Rae's user avatar
  • 27
1 vote
2 answers
30 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 ...
Rae's user avatar
  • 27
0 votes
1 answer
305 views

Recover runs, but leaks 472 bytes in 1 block

The code for recover (pset4) works fine, and has passed check50, except for the last check - no memory leaks. Valgrind shoots back: ==5482== Memcheck, a memory error detector ==5482== Copyright (C) ...
Hamster1303's user avatar
0 votes
1 answer
62 views

Pset5 speller memory error --valgrind says no leaks

I almost finished pset 5 speller, I ran check50 and only the last criteria was not matched. That is "valgrind tests failed; see log for more information." The confusing thing is, when I ran ...
Eva Chen's user avatar
0 votes
1 answer
80 views

PSET5 - Speller - Valgrind returns memory leak

After many trials, I am currently stuck in this Pset. The full code that I have is as follows: // Implements a dictionary's functionality #include <ctype.h> #include <stdbool.h> #include &...
Dr. Whiskers's user avatar
0 votes
1 answer
151 views

Memory leak in Recover (PSet4)

I'm working on Recover and it all works fine but I've got a memory leak I don't know how to get rid of. My code is this: #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
software_dev_wannabe's user avatar
0 votes
0 answers
12 views

where is the memory leak in my code?

cant find where is the memory leak here is my code // Implements a dictionary's functionality #include <stdio.h> #include <ctype.h> #include <stdbool.h> #include <string.h> #...
Omar Rehan 777's user avatar
0 votes
0 answers
128 views

Pset5 Speller Memory Problem

I am having a memory issue with my program in speller. Check50 returns all green except for the last line which says :( program is free of memory errors expected "MISSPELLED WOR...", not &...
sage7major16's user avatar
0 votes
1 answer
225 views

Valgrind says 8,013,096 bytes in 143,091 blocks are still reachable in loss record 1 of

Hi) I understand that something incorrect with unload function and that 143,091 blocks it's basically the number of words in the dictionary that was uploaded by the program and I didn't manage to ...
NikitaKvitka's user avatar
0 votes
2 answers
81 views

Help In Solving Memory Leak For PSET5

I need to fix the memory leak error for me to complete pset5. When running my code, I get: :) dictionary.c exists :) speller compiles :) handles most basic words properly :) handles min length (1-char)...
Nobody's user avatar
  • 23
0 votes
1 answer
42 views

My Code compiles but I am getting a leak "8,013,096 bytes in 143,091 blocks are still reachable in loss record 1 of 1"

I see that valgrind is saying that the leak is happening at malloc but I am not sure how to free it seeing where it is allocated (within loop). Please help. ''' // Implements a dictionary's ...
Drey's user avatar
  • 3
0 votes
1 answer
30 views

PSET5 Load function leaking memory

I'm having a problem with memory leak, when I use Valgrind it tells me that I have 512bytes of memory leaked, I know the problem is with load because of Valgrind and because my load functions is ...
Eduardo Moraes's user avatar
1 vote
2 answers
35 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 ...
Dynamo Denis's user avatar
0 votes
1 answer
508 views

Pset5 - Speller - memory leak?

My programme runs and I'm passing all the checks bar the last one. When I run the check with --log I get this response: :( program is free of memory errors valgrind tests failed; rerun with --log ...
Wh0am3ye's user avatar
0 votes
1 answer
78 views

Speller pset 5: Valgrind gives me error

I am doing pset 5 speller and It seems to be okey less valgrind check. Valgrind HELP50 gives me these errors ==22585== Use of uninitialised value of size 8 ==22585== at 0x40110B: hash (dictionary.c:...
santiago correa's user avatar
0 votes
2 answers
160 views

Speller Valgrind Issues

I've been trying to finish up the speller pset, and while everything works well, I keep getting a memory leak. When I rerun check50 with --log, I get: checking for valgrind errors... 56 bytes in 1 ...
Hana Ali's user avatar
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 ...
DigitalPancake's user avatar
0 votes
1 answer
57 views

PSET5: memory leak in check function

bool check(const char *word) { unsigned int hash_index = hash(word); node *trav = table[hash_index]; while (trav != NULL) { int len = strlen(trav->word); char ...
Uzayer Masud's user avatar
0 votes
1 answer
32 views

Pset5 - Where am I leaking 1 block of memory?

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include "dictionary.h" #include <string.h> #include <...
Shriever's user avatar
1 vote
1 answer
753 views

Pset5: strcasecmp doesn't return 0 when given the same string input

// Implements a dictionary's functionality #include <stdbool.h> #include <strings.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <ctype.h> ...
Uzayer Masud's user avatar
0 votes
1 answer
259 views

PSET 5 Speller Failing free memory of errors final check

So i am so close to finally completing this present and i still have some final errors to go through. Valgrind is saying that it is still leaking memory for some reason and i cant find the reason why. ...
MereDONGP's user avatar
0 votes
1 answer
197 views

Cannot understand why valgrind is giving error although check50 runs properly

In this problem, (filter), I'm receiving all green from check50. But when I ran valgrind for blurring I got the following error: ==4412== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al....
ucchasgfrank's user avatar
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 ...
snowboly's user avatar
0 votes
1 answer
286 views

CS50 pset5 program is free of memory errors valgrind tests failed;

I'm just minutes away from solving my problem in pset5. But I'm getting the following error from valgrind. ==12523== HEAP SUMMARY: ==12523== in use at exit: 0 bytes in 0 blocks ==12523== total ...
notrealecho's user avatar
0 votes
1 answer
47 views

Confused with Memory Leak in pset5 Even Though the Problem is Fixed. What was wrong with my size function?

Thank you in advance for taking a look at my code. I have been getting this error below: ==4734== 8,011,640 bytes in 143,065 blocks are indirectly lost in loss record 1 of 2 ==4734== at ...
NgKen0995's user avatar
0 votes
0 answers
96 views

PSET5 Valgrind Problem!

I have my code semi working (it passes most of the check50) except Valgrind keeps reporting 'Invalid read of size 1' . Here is a screenshot of the error message: . I used the djb2 hash function. ...
janecrager's user avatar
1 vote
1 answer
148 views

Pset5 SPELLER, CHECK50 errors and memory leak

I've been strugling with this pset for nearly two weeks. Today I finally managed to make it work. When I test this program it works good with given files, but check50 says that it's not working ...
Bijacz's user avatar
  • 50
0 votes
1 answer
488 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== ...
Katie Melosto's user avatar
1 vote
2 answers
8k 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 ...
Katie Melosto's user avatar
0 votes
1 answer
55 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 ...
Chris's user avatar
  • 428
0 votes
2 answers
253 views

Unknown memory leak on "check function" - CS50 Speller

I have trying to decode the information gathered through valgrind with no success. I followed the hints given by valgrind trying too free the malloc'ed node *checker but to no avail. I've searched ...
DGC's user avatar
  • 1
0 votes
1 answer
184 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 ...
uroboros's user avatar
  • 118
0 votes
0 answers
1k views

"Still reachable" in Valgrind

I have noticed on a few programs that, while none of them have any memory leaks, flag a "still reachable" message when run via valgrind. Does "still reachable" simply mean that there are pointers in ...
Gabriel Saul's user avatar
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 ...
AGF's user avatar
  • 1
0 votes
1 answer
132 views

PSET4 unload() don't work

I'm not sure if my unload() function worked properly. I tried to use Valgrind and it said memory leaked 8mb. I tried check50 and it said I have a memory leak. Also, the time takes very long, it ...
Jn Wu's user avatar
  • 55
0 votes
1 answer
381 views

56 Bytes of leaked memory in speller.c pset5

56 Byte memory leak - not sure where it is coming from. Valgrind points to the malloc'd space for nodnew in the load function - in my first version, I created the pointer nodenew and malloc'd the ...
stygarfield's user avatar
0 votes
1 answer
38 views

How is my (custom) program leaking memory? I am preparing myself for pset5

I'm trying to understand how memory allocation and pointers work, since i find pset5 overwhelming. I made a simple program that reads characters from an array, and let them be written into both a new ...
Jelmer den Hertog's user avatar
0 votes
1 answer
177 views

Problem with sorting the last memory leak in pset5 Speller

In my attempt at pset 5's speller I'm trying to free the last memory leak and running into the two same errors. If I don't free the cursor after freeing all the nodes then: Looks like your program ...
William George Bangay's user avatar
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 ...
Krishaan Khubchand's user avatar
0 votes
1 answer
85 views

Pset5 Memory leak with trie scructure

after almost 2 month of working I am finishing the pset5 but... I get memory leaks. valgrind plus help50 is giving me this: Looks like you're trying to access 8 bytes of memory that isn't yours? ...
koko loko's user avatar
0 votes
1 answer
216 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 ...
Ben's user avatar
  • 3
0 votes
1 answer
46 views

find the leak! pset5

I have run ./test which processes this function: bool unload(void) { //free up memory from linked list for (int i = 0; i < 26; i++) { if (hashtable[i] != NULL) { ...
faelesterio's user avatar
0 votes
1 answer
111 views

Why C doesn't check for memory leaks automatically?

If there is a tool like valgrind which allows to prevent memory leaks in a program, why the compiler doesn't use it and gives you the appropriate warnings? It would be too slow?
Camilo's user avatar
  • 138
0 votes
1 answer
238 views

Pset 5 - valgrind errror because of memory leak

Succesfully finished Pset5 except for one memory leak error. This is the Valgrind and Help50 report: ==32337== ==32337== HEAP SUMMARY: ==32337== in use at exit: 47 bytes in 1 blocks ==32337== ...
JJuice's user avatar
  • 119
0 votes
1 answer
223 views

pset5 speller valgrind show leak in load function

my speller code works very well with all texts but when i ran valgrind there was heap leak in load() specifically in new_node malloc can you help me figure out why? there is my code for load() and ...
Ola Darwish's user avatar
0 votes
1 answer
84 views

PSET5. Free a variable outside a loop. leaking memory

I've been stuck for days in the implementation of LOAD with a TRIE data structure. I think my code works (well it doesn't show seg faults) but I am getting a lot of memory leaks. I implemented the ...
Diego Miquilena's user avatar
2 votes
1 answer
348 views

Pset5 Speller Valgrind error

I got Pset5 Speller to work correctly but I am getting a Valgrind error as follows 568 bytes in 1 blocks are still reachable in loss record 1 of 1: (file: dictionary.c, line: 108) for all the words. ...
noob's user avatar
  • 23
0 votes
1 answer
247 views

pset5 speller unload (trie) leaking memory

My unload function is leaking memory. Valgrind says that 8,960 bytes in 40 blocks were definitely lost, and 38,752 bytes in 173 blocks were indirectly lost. I'm not sure why...my unload function makes ...
Jason_V's user avatar
  • 182
1 vote
1 answer
82 views

Valgrind memory leak, WORDS MISSPELLED: 1 pset5

Looks like your program leaked 1,120 bytes of memory. Did you forget to free memory that you allocated via malloc? Take a closer look at line 48 of dictionary.c. Its weard because i am freeing the ...
ravi s's user avatar
  • 13