Timeline for Help With Pset5 Unload (Valgrind issue)
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:37 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Oct 23, 2016 at 10:43 | comment | added | Martin Kleiven |
I have my hashtable[index] point to a node. If you store a word at a given index then in the event of a collision, you will not have a place to store the new word.
|
|
Oct 22, 2016 at 21:34 | comment | added | AdiKhajuria | Just doing some debug with GDB as you suggested. Each node of my struct contains a field called wordArray (my string/char* that contains each word) and the so-called "next" pointer which points to the next node. I don't know if this has anything to do with this issue It turns out that hashtable[i] ->wordArray (AKA first->wordArray) contains a word. Right now my load function is loading each word into first->wordArray. Is this wrong(i.e. should hashTable[i] just point to a linked list instead of storing a word)? | |
Oct 22, 2016 at 18:27 | comment | added | Martin Kleiven | I noticed that (valgrind was kind enough provide it), what I meant if I wasn't clear enough is, since six nodes were not freed then probably no nodes ever get freed. I recommend you run GDB on unload() and try to get an idea of what's going on :) | |
Oct 22, 2016 at 18:10 | comment | added | AdiKhajuria | I know that you might be pre-occupied right now but just for clarity I should mention that I created my own dictionary and text files. Both of them are 6 words long. | |
Oct 22, 2016 at 16:54 | comment | added | Martin Kleiven | I'm sorry for my brainfart there. If your text is 6 words and 6 nodes are not freed, then you've freed nothing. I'm not entirely sure but it seems your free statement is never reached. Right now I'm too preoccupied to look any deeper but know that the issue lays in unload(). | |
Oct 22, 2016 at 16:30 | comment | added | AdiKhajuria | I saw your updated answer. If I free what was malloc'ed in line 89 within the load function then that would mean check and size would not have any nodes to work with. | |
Oct 22, 2016 at 16:17 | comment | added | Martin Kleiven | See my updated answer. | |
Oct 22, 2016 at 16:17 | history | edited | Martin Kleiven | CC BY-SA 3.0 |
added 105 characters in body
|
Oct 22, 2016 at 16:09 | history | edited | Martin Kleiven | CC BY-SA 3.0 |
added 105 characters in body
|
Oct 22, 2016 at 15:59 | comment | added | AdiKhajuria | The problem that I am having right now is that valgrind is saying that I have not free'd everything. This is starting to make me think that I have not free'd the linked lists inside of my hashtables in the wrong order. | |
Oct 22, 2016 at 15:31 | history | answered | Martin Kleiven | CC BY-SA 3.0 |