revised
pset6 server trapped in if (connected())
deleted 73 characters in body
Loading…
revised
pset6 server trapped in if (connected())
deleted 307 characters in body
Loading…
revised
pset6 server trapped in if (connected())
deleted 5 characters in body
Loading…
revised
pset6 server trapped in if (connected())
deleted 3 characters in body
Loading…
comment
pset6 server trapped in if (connected())
I fixed the problem you pointed out, and tried gdb again. this time I set break point at parse and using curl to request hello.html. I followed the instruction here cs50.stackexchange.com/questions/16688/debugging-webserver-in-c/… However, the gdb does not show any error, the code gets HTTP/1.1 200 OK. and then goes back to if(connected()), and stuck in there again..... I need some more clue.... thanks!
Loading…
Loading…
comment
pset5 unload recursion causes memory leaks
A minor question: I test my code with a small dictionary, which contains only 1 word "a". Valgrind reports there are 4 allocs. I drew the trie structure, it only takes 2 nodes, one is root the other is the node with is_word returning true. Why the code malloc 4?
revised
pset5 unload recursion causes memory leaks
edited title
Loading…
Loading…
comment
pset5, have a seg fault but valgrind reports no error
My code passes the "check50", but I really want to fix all the error reported by valgrind. I do not understand why there is invalid read at " if (destroyer->children[j] != NULL) " by unload....
revised
pset5, have a seg fault but valgrind reports no error
deleted 101 characters in body
Loading…
comment
pset5, have a seg fault but valgrind reports no error
I used 1 word dictionary, valgrind reports 4 alloc and 3 free. ( I can't see why it takes 4 alloc to build a only 1 word dictionary.) And after I modified the codes, gdb does not reports any fault, the main funtion exits successfully, returning 0 and shows the "time report". Just the valgrind reports the first invalid read of size 8 at " if (destroyer->children[j] != NULL) " by unload. I edited the code and hope some hints so that I can make the code better :)
comment
pset5, have a seg fault but valgrind reports no error
I fixed the seg fault. It's not the recursion. It's how I set the pointer destroyer. Anyway, although I got rid of the seg fault, I still have the problem: Valgrind reports total heap usage: 14 allocs, 3 frees, 3,824 bytes allocated after running with a small dictionary with only 5 words. Could you give me some hint on what's wrong with my unload function? I really want to figure out how to successfully unload all the nodes. Thanks
comment
pset5, have a seg fault but valgrind reports no error
I added return true after free(destroyer), but still, seg fault...
Loading…