Questions tagged [memory-leak]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
30 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 ...
0
votes
1answer
24 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:...
0
votes
2answers
22 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 ...
0
votes
0answers
21 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
1answer
32 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 ...
0
votes
1answer
23 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 <...
0
votes
1answer
40 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> ...
0
votes
1answer
61 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. ...
0
votes
1answer
29 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....
0
votes
1answer
44 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
1answer
50 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 ...
0
votes
1answer
34 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 ...
0
votes
0answers
64 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. ...
1
vote
1answer
97 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 ...
0
votes
1answer
74 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== ...
0
votes
1answer
563 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
2answers
122 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 ...
0
votes
0answers
328 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 ...
0
votes
1answer
125 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 ...
0
votes
1answer
179 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 ...
0
votes
1answer
32 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 ...
0
votes
1answer
132 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 ...
0
votes
1answer
8 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
1answer
77 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? ...
0
votes
1answer
107 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
1answer
36 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) { ...
0
votes
1answer
43 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?
0
votes
1answer
69 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== ...
0
votes
1answer
176 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 ...
0
votes
1answer
71 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 ...
1
vote
1answer
259 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. ...
0
votes
1answer
221 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 ...
1
vote
1answer
79 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 ...
1
vote
2answers
148 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 ...
0
votes
2answers
95 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; ...
0
votes
1answer
53 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 ...
0
votes
1answer
210 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 ...
0
votes
1answer
92 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 ...
0
votes
2answers
268 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(...
2
votes
1answer
180 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 ...
0
votes
1answer
138 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 ...
1
vote
1answer
140 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....
0
votes
1answer
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) + ...
2
votes
1answer
342 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 ...
0
votes
1answer
159 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, ...
0
votes
1answer
751 views

Pset5: valgrind still reachable

My code passed the check50. But valgrind reported still reachable leaks. Some posts I'v read suggests that it is OK to have still reachable leaks. Is it really so? If not, how can I fix it? What does "...
0
votes
1answer
230 views

pset5 unload recursion causes memory leaks

In pset5, I have made load (using a trie), check and size run successfully, even my whole codes passed check50. I believe so because when I do spell check a text using the big library, I get the same ...
1
vote
1answer
46 views

GetString() & Dynamic Memory Allocation

I observed in a walkthrough video in Week 4 (structs-0, I believe) David mentions that any variable created with GetString() should be free()d after its usage, due to the fact that, I vaguely quote ...
0
votes
1answer
145 views

Pset5 unload trie 244 bytes lost

So, I'm finishing up pset5 and I'm now just trying to make sure theres no memory leaks. Unfortunaly there are 244 bytes being lost and I'm not sure why they're being lost. This is my free code: bool ...
0
votes
1answer
703 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 ...