Closed coryshrmn closed 11 years ago
So this actually happens by just running the program at all. Not sure what changed.
I fixed the first part by removing:
free(fname);
...from main, but there is still the malloced fname which is leaked. I commented the malloc line in WebsiteCatalog.c
Could you test master branch d1d4f8a0b31339a3413ebedc61ac9cb91f524907 ? I don't see any memory leaks now.
The fname memory leak seems to be fixed, however there is now a memory leak in promptInput.
==2290== HEAP SUMMARY: ==2290== in use at exit: 11 bytes in 1 blocks ==2290== total heap usage: 107 allocs, 106 frees, 6,427 bytes allocated ==2290== ==2290== 11 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==2290== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==2290== by 0x403663: promptInput (WebsiteCatalog.c:118) ==2290== by 0x40349D: InitDriver (WebsiteCatalog.c:47) ==2290== by 0x40343E: main (WebsiteCatalog.c:20) ==2290== ==2290== LEAK SUMMARY: ==2290== definitely lost: 11 bytes in 1 blocks ==2290== indirectly lost: 0 bytes in 0 blocks ==2290== possibly lost: 0 bytes in 0 blocks ==2290== still reachable: 0 bytes in 0 blocks ==2290== suppressed: 0 bytes in 0 blocks
By the way, that last comment is from a simple sample run:
Please enter the filename: top_25.txt ================================================ 1 - Insert a Website 2 - Delete a Website by URL 3 - Search for a Website by URL 4 - Print hash buckets 5 - Print BST in order 6 - Print BST indented 7 - Print hash efficiency 8 - Save 9 - Save as... 10 - Quit ================================================ Enter your option (1-10): 10 >VERBOSE : Exiting program on user request
That should be normal. On Mar 25, 2013 6:51 AM, "coryshrmn" notifications@github.com wrote:
By the way, that last comment is from a simple sample run:
Please enter the filename: top_25.txt
1 - Insert a Website 2 - Delete a Website by URL 3 - Search for a Website by URL 4 - Print hash buckets 5 - Print BST in order 6 - Print BST indented 7 - Print hash efficiency 8 - Save 9 - Save as...
10 - Quit
Enter your option (1-10): 10
VERBOSE : Exiting program on user request
— Reply to this email directly or view it on GitHubhttps://github.com/coryshrmn/websitecatalog/issues/22#issuecomment-15394036 .
The output is normal, but there is a memory leak.
11 bytes in 1 blocks are definitely lost in loss record 1 of 1 at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x403663: promptInput (WebsiteCatalog.c:118) by 0x40349D: InitDriver (WebsiteCatalog.c:47) by 0x40343E: main (WebsiteCatalog.c:20)
I couldn't find the memory leaks with latest master branch of the following commit: 51e33464e8cfa428cb1018989be6a4df21317060.
If problem persists on your valgrind, please show me during the class. We can trace them together.
See you soon!
We fixed this in class today.