Questions tagged [valgrind]

The tag has no usage guidance.

43 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
46 views

Pset5 Speller — Conditional jump or move depends on uninitialised value(s); Uninitialised value was created by a stack allocation;

My code is able to pass all the tests in check50 except the valgrind one. Here is the error when I run the valgrind. Could someone help me, please? // Implements a dictionary's functionality #...
1
vote
0answers
2k views

Valgrind says “Invalid read of size 4” while freeing memory recursively in a trie

My PSET "mispelling" works fine and contains no memory leak but when I run the program with Valgrind it says Invalid read of size 4. My unload function calls a deleteTrie function which looks like ...
0
votes
0answers
5 views

Lab 5 valgrind error only with specific variable name

I am currently doing lab 5:Inheritance on CS50. I came across a interesting error. when i create a person object with the name person as follows, //Create a new individual with generations person *...
0
votes
1answer
28 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
2answers
56 views

Pset5 - Speller - Valgrind error for malloc in load function

I get all test results correct except the Valgrind error as follows, does anyone know why is it so and share some insights please? thanks! running valgrind --show-leak-kinds=all --xml=yes --xml-file=/...
0
votes
0answers
26 views

How do I interpret Valgrind to fix this program's segmentation fault?

I was attempting PSet 4's Recover but kept running into a segmentation fault. I tried using Valgrind to debug it but I have no idea of how to interpret the error message. My code: #include <stdio.h&...
0
votes
0answers
16 views

PSet 5 Speller - Valgrind Segmentation Fault

I keep getting a hit on valgrind. It says to check line 99 but I know I free(cursor) before the end of the block :-( my entire code
0
votes
1answer
56 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
76 views

Pset 5 Help understanding Valgrind output

I was wondering if anyone could help me with interpreting the Valgrind error to trouble shoot. There are no memory leaks, but I am getting this error "Conditional jump or move depends on ...
0
votes
1answer
41 views

pset4: recover segmentation fault

The code compiles fine but when running ./recover i keep getting a seg fault. i tried valgrind but still can't seem to get what the problem is exactly. #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
92 views

pset5 valgrind tests failed

I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...
0
votes
1answer
177 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
2answers
72 views

Valgrind errors: “invalid read of size 8” and “…uninitialised value” (pset5, speller)

I have basically finished the code, no memory leaking and tests work out fine. However, Valgrind is not happy: Conditional jump or move depends on uninitialised value(s): line 141 This is one of the ...
0
votes
1answer
50 views

PSET5 Speller using trie memory leak

Could somebody help me identify the cause of the memory leak shown by Valgrind? Check50 says that there are no leaks, for some reason. Here is my code for dictionary.c // Implements a dictionary's ...
0
votes
1answer
154 views

Valgrind uninitialized values pset5

This is my solution for pset5's speller problem, which uploads a dictionary with a hash table and checks an inputed text to find misspelled words. My code works fine when I run, but valgrind says "...
0
votes
1answer
72 views

Check function Segmentation

I am struggling to find the problem in my check function. I have a segmentation fault that it's position varies every time I alter my code a bit. bool check(const char *word) { int index = hash(...
0
votes
0answers
86 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. ...
0
votes
0answers
41 views

Need help fixing memory leaks

I need help fixing the memory leaks on the code! I have already tried fixing them, but I have no clue how to do so. Here is the complete code: // Implements a dictionary's functionality #include &...
0
votes
0answers
41 views

PSET 5 - Valgrind - Invalid read of 8 - Unload

So close to submission! - However, when I check using valgrind the ouptut is: ==22743== Invalid read of size 8 ==22743== at 0x40135C: unload (dictionary.c:123) ==22743== by 0x400E59: main (...
0
votes
1answer
236 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
21 views

valgrind return memory leaking even after free()

This is a code that I have written based on 2013 Section question. I put free at the getAge() function but it is still returning error after running valgrind through it. I really dont know why. Any ...
0
votes
0answers
851 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
0answers
47 views

Problem with pset4 2019 trie dictionary

I'm having problems with my trie dictionary.c file, if I try to run the whole program normally or through gdb, I'm getting no errors whatsoever and I'm getting the right answers. Tho, when I try to ...
0
votes
1answer
50 views

Pset4 Speller (valgrind)

// Unloads dictionary from memory, returning true if successful else false bool unload(void) { // TODO node *ptr; while (root) { int last_child; node *tmp; ptr =...
0
votes
1answer
63 views

cs50 pset4 speller trie word too long “index 46 out of bounds for type 'char [46]'”. Isn't that handled by the code already written?

My code is giving all the right answers (lalaland.txt), but valgrind says: ==9947== dictionary.c:69:25: runtime error: index 46 out of bounds for type 'char [46]' (and I printf the problem - too ...
0
votes
1answer
612 views

Pset5 Speller (using hash table) unload multiple errors

I have successfully implemented pset5 speller using a hash table, but am facing some residual issues with the unload() function. I am unable to resolve a number of errors that are identified by ...
0
votes
0answers
25 views

Valgrind throws a memory error and I think it's not okay with mouse set to NULL. I don't know how to fix it. Please help

bool unload(void) { node *cursor = NULL; node *temp = NULL; for(int i = 0; i < 26; i++) { cursor = hash_table[i]; ...
0
votes
1answer
9k views

invalid read of size 1 — Valgrind error

This is what valgrind is giving. ==7194== Invalid read of size 1 ==7194== at 0x4C2E0F4: strlen (in /usr/lib/valgrind/vgpreload_memcheck- amd64-linux.so) ==7194== by 0x42278F: insert (tries.c:34)...
0
votes
1answer
45 views

Does anyone know how to fix this problem?

this error is in every check50 test. Conditional jump or move depends on uninitialised value(s): (file: dictionary.c, line: 92) Conditional jump or move depends on uninitialised value(s): (file: ...
0
votes
2answers
203 views

pset5 Speller -load - Valgrind error - “invalid read of size 8”(segmentation fault)

i have been trying to figure this out but need some help! even a hint will do... //trie node typedef struct trie_node { struct trie_node* parent; struct trie_node *child[27]; //check is ...
0
votes
1answer
14 views

Only getting 3 frees in Speller

No matter what text I test this with, I only ever get 3 or maybe 4 frees using Valgrind. Any ideas why? /** * Implements a dictionary's functionality. */ #include <stdbool.h> #include "...
0
votes
1answer
368 views

Pset5 Speller Load - Segmentation Fault - Valgrind error: Invalid read of size 8

this is my first post to this forum so I hope I've followed correct procedure. I get a segmentation fault when I run speller. Valgrind says the problem is "Invalid read of size 8" at line 114 in the ...
0
votes
0answers
61 views

pset5 segmentation fault after check50 passed

After fixing and running pset5 most recently yesterday, it made it through check50 with no errors -- all smiley faces. I ran valgrind and found a number of leaks which were repaired by removing an ...
0
votes
1answer
44 views

Error in my cs50's unload function in pset5 - speller - trie

This my code for dictionary.c but each time i run speller.c i'm getting a segmentation error. I'm not able to understand where my this code is leaking memory! Can anyone help? typedef struct node { ...
0
votes
0answers
230 views

Pset5 speller.c valgrind errors in load and check

I have problem with speller.c. Check50 shows that everything is good but when I run valgrind there are a lot of errors. There are no memory leaks, but number of errors is huge. I ve already search for ...
0
votes
2answers
393 views

pset5 valgrind not happy with load (also, using malloc vs calloc on trie)

First, valgrind flags the file pointer at the fopen call, and also the malloc call to the root pointer. It designates both still reachable in loss record. Second, since for pset5 I check for an end ...
0
votes
0answers
67 views

Valgrind Error on Find

I know it's not required to run valgrind on find in pset3, but I was seeing some funky things in check50 and tried it out. The following errors appear: ==7866== 1 errors in context 1 of 2: ==7866== ...
0
votes
1answer
898 views

Conditional jump or moves depends on uninitialized values

I am getting the following valerind error. ==9649== Conditional jump or move depends on uninitialised value(s) ==9649== at 0x80493AD: check (dictionary.c:152) ==9649== by 0x8048A6D: main (...
0
votes
1answer
778 views

Pset4 recover not passing check50, but I can see the recovered .jpg files

I have run my program and it works! I get 16 .jpg files, all of which I can see when I open them. When I run check50, however it fails on jpg 000.jpg and 001.jpg through 014.jpg, but not 015.jpg?! ...
0
votes
0answers
72 views

pset4 getting slow

Definitely I have some memory problems, could someone help me to fix it? The game is working fine except that gets very slow when I reach half of the game.
0
votes
1answer
35 views

Pset5 Speller Valgrind error trouble

Baby programmer over here. Before moving on to the (check) function, I wanted to make sure the (load) function was correct. After performing Valgrind, I received the following errors. Up to this point,...
0
votes
1answer
38 views

Speller Valgrind Error

I worked on the speller code for bath 2020 for cs50x course. My code passed all test cases but got stuck at a valgrind error. Im new to this and Im unable to comprehend valgrind logs. Please help ...
0
votes
1answer
1k views

Valgrind still reachable memory

For my pset5 speller program valgrind is saying that i have still reachable memory. This is the output: HEAP SUMMARY: ==24516== in use at exit: 352 bytes in 1 blocks ==24516== total heap usage: ...