|
From: Suresh Sundararaman-A. <Sun...@mo...> - 2004-03-03 05:04:24
|
Hi For my program, Valgrind tool provides a leak summary something like this: ==7554== ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 0 from 0) ==7554== malloc/free: in use at exit: 1458 bytes in 46 blocks. ==7554== malloc/free: 173 allocs, 127 frees, 4942 bytes allocated. ==7554== For counts of detected errors, rerun with: -v ==7554== searching for pointers to 46 not-freed blocks. ==7554== checked 10585084 bytes. ==7554== LEAK SUMMARY: ==7554== definitely lost: 0 bytes in 0 blocks. ==7554== possibly lost: 0 bytes in 0 blocks. ==7554== still reachable: 1250 bytes in 44 blocks. ==7554== suppressed: 200 bytes in 1 blocks. I would like to know the difference between "possibly lost", "still reachable" and "suppressed". I checked my code and I don't find a leak in my program. But the tool says there are some not-freed blocks. Is it a bug in the tool or in my program? Under what conditions, this kind of a scenario would happen? Do I have necessarily use the information given in "still-reachable" and "suppressed" to solve memory leaks in any program? Thanks Suresh |
|
From: Attila <sa...@fr...> - 2004-03-03 07:41:38
|
Hi, > I would like to know the difference between "possibly lost", "still reachable" > and "suppressed". Develeopers, please append it to FAQ (as it seems to be frequently asked) with the appropriate links to the documentation. Please read section 3.6 at valgrind documentation at e.g.: http://developer.kde.org/~sewardj/docs-2.0.0/mc_main.html I have posted a message a few days ago, where I also described it in my words: "If I understood correctly: - definitely lost means that you have the memory block allocated and you have lost the pointer to it (in which case there is no chance for your application to free it anymore). - still reachable means that you have the memory block allocated and you still have the pointer for it (reachable). This is not necessary a bug, some software is designed to do so (for performance reasons, they say, but I don't know how much would it degrade the performance to clean up correctly before you exit your application) leaving the task of freeing the memory to the OS. If it's not a bug and you don't want to see the messages just make sure --show-reachable is not set to yes." Supressed: You are kindly requested to read section 3.4 of the above mentioned document, which includes the reference to this: http://developer.kde.org/~sewardj/docs-2.0.0/coregrind_core.html#suppress Attila |