Questions tagged [memory-leak]
The memory-leak tag has no usage guidance.
78
questions
0
votes
0
answers
53
views
How can I fix this double free in speller?
I've posted this question previously but I tried to post various functions from my code without posting the whole code at once, because I thought that was better etiquette or something. However, the ...
0
votes
1
answer
139
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) ...
0
votes
1
answer
45
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 ...
0
votes
1
answer
63
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 &...
0
votes
1
answer
112
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>
...
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>
#...
0
votes
0
answers
103
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 &...
0
votes
1
answer
174
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 ...
0
votes
2
answers
79
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)...
0
votes
1
answer
40
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 ...
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 ...
0
votes
1
answer
27
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
1
answer
468
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
1
answer
77
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
2
answers
151
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
0
answers
102
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
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 ...
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 <...
1
vote
1
answer
688
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
1
answer
256
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
1
answer
172
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
1
answer
99
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
240
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
1
answer
46
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
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. ...
1
vote
1
answer
147
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
1
answer
462
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
2
answers
7k
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
2
answers
250
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
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 ...
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 ...
0
votes
1
answer
356
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
1
answer
36
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
1
answer
176
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
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
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? ...
0
votes
1
answer
198
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
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)
{
...
0
votes
1
answer
101
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
1
answer
228
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
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 ...
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 ...
2
votes
1
answer
341
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
1
answer
245
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
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 ...
1
vote
2
answers
178
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
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;
...
0
votes
1
answer
60
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
1
answer
283
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
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 ...