Questions tagged [valgrind]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
74 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
1answer
155 views

Pset 5 Speller valgrind error

I am trying to fix the last error in my code pointed out by check 50. I think the problem is in my unload but can't say for sure. Here's my code. I know I have some basic functionalities wrong but ...
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 #...
0
votes
1answer
78 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
53 views

SEGFAULT in pset5 speller

I'm working on pset5 2020 speller. I have managed to get my code to compile but no matter how small the input data sets are I suffer a segmentation fault. I've run valgrind and there only seems to be ...
0
votes
1answer
57 views

CS50 Pset 5 speller valgrind error

I am currently trying to master speller but getting an error in one specific line when I run valgrind. It mentions this line: n ->next = table[index]; I have no idea why. It says invalid read of ...
0
votes
1answer
65 views

CHECK50 ERRORS IN SPELLER PSET

Here is my code for the pset I am getting 2 errors after check50. I am not able to get hold of any loopholes in the code. Kindly help! 1) :( handles max length (45-char) words expected "MISSPELLED ...
0
votes
1answer
77 views

pset5 Speller Valgrind conditional jump or move depends on uninitialized values

Sorry for asking about a valgrind-reported error that has been asked many times. I've read through many of the questions and responses, but I could not find an answer that applies to my problem. The ...
0
votes
1answer
97 views

pset5 - check50 fails at valgrind but valgrind directly seems to show no errors?

#include <stdbool.h> #include <cs50.h> #include <string.h> #include <strings.h> #include <ctype.h> #include <stdlib.h> #include "dictionary.h" const int ...
0
votes
0answers
88 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
44 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 (...
1
vote
1answer
123 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
107 views

valgrind on filter -r. No leaks but errors

I am working on pset4 filter -r (reflection). How I want to achieve reflection: Reserve space in memory, enough to fit an image. Name it image-copy. Copy 1-to-1 the original file there. Original ...
0
votes
1answer
45 views

And one more “Invalid read of size” problem

So I've managed to write a program, which compiles, cleared all the segmentation fauls, made it to do all the required tasks correctly, like creating a hash table, cheacking for the misspelled words ...
0
votes
1answer
246 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
3k 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
1answer
966 views

valgrind tutorial?

Is there a tutorial or link someone might direct me towards to how to use and analyze valgrind to find memory leaks. I've passed Pset4 Speller, but lost points on memory leaks. I thought it might be ...
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
1answer
325 views

PSET4 Recover munmap_chunk(): invalid pointer

This my solution to recover problem. It works, but it produces "munmap_chunk(): invalid pointer" error: And Valgrind outputs: ==5906== LEAK SUMMARY: ==5906== definitely lost: 0 bytes in 0 ...
0
votes
0answers
881 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
89 views

Speller(hashtable) VALGRIND ERRORS!

i don't know or understand through val grind where and what i'm doing wrong. Except for memory errors my code outputs as correct in check50. my code // Implements a dictionary's functionality #...
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
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
64 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
424 views

Failing last check on memory errors - “program is free of memory errors”

When I run check50 the code fails on the last check below: "valgrind tests failed; rerun check50 with --log added to end of command for more information." See https://cs50.me/checks/...
0
votes
1answer
312 views

Valgrind passed (no leaks) but CS50 check fail

Hi~ Could you please tell me the reason I can’t pass CS50 check? It seems there is no error when I run valgrind ./speller texts/lalaland.txt (I count the nodecount q’ty during LOAD and confirmed the ...
0
votes
1answer
124 views

Problem Set 4 Valgrind

I tried to implement Speller, but check 50 returns: :( program is free of memory errors valgrind tests failed; rerun check50 with --log added to end of command for more information. When I run ...
0
votes
1answer
617 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
1answer
44 views

Pset 5 speller - accessing node->next results causing problems with valgrind

As the title says, every time I access node->next and run valgrind, it says I have an 'invalid write size of 8'. When I run check50, I get all smileys except the last for the last check. I have tried ...
0
votes
1answer
50 views

Valgrind 1000000 errors

My code for loading the dictionary in tries is this: // Insert words into trie while (fscanf(file, "%s", word) != EOF) { node *next_node; // Iterate trought every letter of word for (int ...
0
votes
1answer
448 views

Speller (pset 4 2019) - Can't fix memory leak in hashtable

I've been working on speller, and all my code does the job fine but I can't get rid of the memory leak valgrind is giving me. It seems to be something to do with my load function. I think it's my ...
0
votes
1answer
856 views

pset5 speller, not sure what's wrong with code

I'm sort of at my wit's end with this pset and I can't pinpoint where my errors are. Running valgrind says I'm trying to access 8 bytes of memory in my load() function around where I check if the ...
1
vote
1answer
51 views

pset5 speller running valgrind says I'm accessing 8 bytes of memory that isn't mine

So I used a trie to implement speller, and when I run valgrind on my speller.c, it says that around my unload() function and my freeTrie() function I am accessing 8 bytes of memory that isn't mine. I ...
0
votes
1answer
119 views

pset5 - Conditional jump or move depends on unintialized value

Valgrind seems to complain with my unload() function, in particular the cursor: bool unload(void) { node *cursor; for (int l = 0; l < 27; l++) { if (hashtable[l]) { ...
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
55 views

Memory leaks on unload

All tests pass except the valgrind check at the end. I am sure that my unload algorithm isn't correct, but I checked like 5 times, and I can't find logic flaw. I don't need solution, just a hint ...
0
votes
1answer
160 views

Memory leaks in Speller

My program passes all tests except the valgrind check. I tried to find the cause of errors, but valgrind is too 'obscure' for me yet, I don't know what to do. I guess some memory isn't freed, but I ...
0
votes
1answer
69 views

pset5 (trie) valgrind memory leak

I'm having trouble with the last step of pset5, valgrind. When I run it with the test text I get: Looks like you're trying to access 8 bytes of memory that isn't yours? Did you try to index into an ...
0
votes
1answer
162 views

pset5 “words in dictionary” is 0

I'm not having much luck troubleshooting my speller code. It returns the correct misspelled words and words in text, but words in dictionary returns as 0. I ran valgrind and it said there is a leak in ...
0
votes
1answer
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 ...
0
votes
1answer
536 views

pset5 speller program is free of memory errors

I have search around alot of places and even looked at others code but I dont find my code is that much different. I keep getting program is free of memory errors if I check with cs50. I can run my ...
0
votes
1answer
740 views

Pset5 : Speller: Valgrind : Blocks are still reachable

I have my code running well. But Valgrind still shows 568 bytes as reachable. Detailed Valgrind log is here: ==5709== ==5709== HEAP SUMMARY: ==5709== in use at exit: 568 bytes in 1 blocks ==5709=...
0
votes
1answer
81 views

Variable length array, Valgrind. [URGENT HELP NEEDED!]

#include <stdio.h> #include <stdlib.h> int main() { long k; scanf("%ld", &k); long *number = calloc(k,sizeof(long)); for (int i = 0; i < k ; i++) { scanf("%ld"...
0
votes
1answer
473 views

PSET5 check50 Speller HELP please!

I checked50 and this showed up program is free of memory errors valgrind tests failed; rerun with --log for more information. What did I do wrong? Valgrind showed no error... #include <...
1
vote
1answer
39 views

Memory leak and erratic behavior with code

Right now, I have been stuck for a while on the speller problem of pset7, due to some erratic behavior of my code. On some versions of it, many words appeared to be misspelled, but not all of them; ...
0
votes
1answer
1k views

Pset5: Conditional jump or move depends on uninitialised value(s)

I have this code: node *cursor = hashtable[i]; while(cursor != NULL) { if (strcmp(word_cpy, cursor -> word) == 0) { return true; ...
0
votes
1answer
40 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
2answers
191 views

Pset5 - Valgrind causes 9544106 errors, Uninitialised value was created by a heap allocation

Im unsure if there is any error in my recursion in unloading/unload to free all memory. (But i doubt so because help50 tells me all my memory were freed- 367,084 allocs, 367,084 frees) I checked ...