Questions tagged [memory-leak]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
44 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 ...
user avatar
0 votes
2 answers
52 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)...
user avatar
  • 23
0 votes
1 answer
39 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 ...
user avatar
  • 3
0 votes
1 answer
28 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 ...
user avatar
0 votes
1 answer
22 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 ...
user avatar
0 votes
1 answer
240 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 ...
user avatar
0 votes
1 answer
75 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:...
user avatar
0 votes
2 answers
101 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 ...
user avatar
0 votes
0 answers
30 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 ...
user avatar
0 votes
1 answer
53 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 ...
user avatar
0 votes
1 answer
29 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 <...
user avatar
1 vote
1 answer
404 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> ...
user avatar
0 votes
1 answer
236 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. ...
user avatar
0 votes
1 answer
86 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....
user avatar
0 votes
1 answer
80 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 ...
user avatar
0 votes
1 answer
113 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 ...
user avatar
0 votes
1 answer
44 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 ...
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. ...
user avatar
1 vote
1 answer
134 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 ...
user avatar
  • 50
0 votes
1 answer
368 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== ...
user avatar
0 votes
1 answer
5k 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 ...
user avatar
0 votes
2 answers
201 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 ...
user avatar
  • 1
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 ...
user avatar
0 votes
1 answer
129 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 ...
user avatar
  • 55
0 votes
1 answer
297 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 ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
0 votes
1 answer
171 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 ...
user avatar
0 votes
1 answer
12 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 ...
user avatar
0 votes
1 answer
84 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? ...
user avatar
0 votes
1 answer
173 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 ...
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) { ...
user avatar
0 votes
1 answer
69 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?
user avatar
  • 38
0 votes
1 answer
181 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== ...
user avatar
  • 119
0 votes
1 answer
214 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 ...
user avatar
0 votes
1 answer
82 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 ...
user avatar
1 vote
1 answer
299 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. ...
user avatar
  • 13
0 votes
1 answer
239 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 ...
user avatar
  • 184
1 vote
1 answer
80 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 ...
user avatar
  • 13
1 vote
2 answers
166 views

Pset5 - Code for dictionary.c works but valgrind returns memory leak

I chose to implement speller with a hash table and the code seems to be working fine and passes check50 except for a memory leak. I read other posts reporting similar issues and I think that the issue ...
user avatar
  • 40
0 votes
2 answers
102 views

pset5. Can't trace memory leak

Load function (with a trie data structure) //DEBUG unsigned int allocs = 0; // define node and create root typedef struct node { bool is_word; struct node* children[27]; } node; node* root; ...
user avatar
0 votes
1 answer
57 views

pset5. Can unload words in dictionary but memory is definitely and indirectly lost

My unload function: void clean(node* trav){ //Iterate over the trie structure for(int i=0; i<CHILDREN_LENGTH; i++){ //Recursively delete deeper nodes if curent node is not null ...
user avatar
0 votes
1 answer
270 views

PSET5: memory leak

Mem. leaking. help. Only written load function but have the free function within load. Haven't fleshed out unload yet. Want to test that load works before fleshing out unload hence have included the ...
user avatar
  • 231
0 votes
1 answer
94 views

Pset5 all words are misspelled and Valgrind reports 15 errors

I can compile pset5 but when I run the program, it treats all words misspelled. Also, Valgrind reports 15 errors and help50 hints that I am trying to access 1 byte of memory that isn't mine. I have no ...
user avatar
0 votes
2 answers
341 views

Pset5 Speller Memory Leak

I have a memory leak. Valgrind told me that I had over 10000000 errors. So what is the problem? Someone told me there was no problem in my unload function, so here's my Load function. bool load(...
user avatar
2 votes
1 answer
221 views

Memory leak in Pset4

According to valgrind I have a memory leak in my version of resize. Here's the valgrind output: ==22900== Memcheck, a memory error detector ==22900== Copyright (C) 2002-2013, and GNU GPL'd, by ...
user avatar
  • 23
0 votes
1 answer
149 views

CS50 PSET5 Memory Leak (updated2)

I had posted two questions regarding memory leak in Problem Set 5, available at CS50 PSET5 Memory Leak and CS50 PSET5 Memory Leak (updated). I got amazing feedback from different people (and I ...
user avatar
  • 121
1 vote
1 answer
146 views

CS50 pset5 Memory Leak (trie structure)

So I've written the functions for pset5 using a trie and it seems to work fine. It gives the same number of misspelled words etc. as the cs50 one, but it seems that there are some memory leak problems....
user avatar
  • 13
0 votes
1 answer
31 views

How/when to free this memory? (pset6/server)

Here is my implementation of the indexes function in pset6: char* indexes(const char* path) { char* php = "index.php"; char* html = "index.html"; char* pathCopy = malloc(strlen(path) + ...
user avatar
  • 3
2 votes
1 answer
370 views

CS50 PSET5 Memory Leak (updated)

I had posted a question here two days ago regarding memory leak in problem set 5 and haven't had it resolved yet. Please refer to my question, available here: CS50 PSET5 Memory Leak (please note that ...
user avatar
  • 121
0 votes
1 answer
166 views

CS50 PSET5 Memory Leak

I have spent more than 30 hours on this problem set and I am still struggling. At first, my program compiled but did not run, due to a segmentation fault. I finally fixed it and everything works fine, ...
user avatar
  • 121