Understanding Valgrind Exit

I made a message earlier, asking about checking for memory leaks, etc., I really said that I did not know what was with the terminal in linux, but someone told me that it was easy with valgrind

I managed to run it, etc., but am not sure what the exit means. Looking at me, everything looks good to me, but I would like to let it pass you by when you may feel folk. The output is as follows:

^C==2420== ==2420== HEAP SUMMARY: ==2420== in use at exit: 2,240 bytes in 81 blocks ==2420== total heap usage: 82 allocs, 1 frees, 2,592 bytes allocated ==2420== ==2420== LEAK SUMMARY: ==2420== definitely lost: 0 bytes in 0 blocks ==2420== indirectly lost: 0 bytes in 0 blocks ==2420== possibly lost: 0 bytes in 0 blocks ==2420== still reachable: 2,240 bytes in 81 blocks ==2420== suppressed: 0 bytes in 0 blocks ==2420== Reachable blocks (those to which a pointer was found) are not shown. ==2420== To see them, rerun with: --leak-check=full --show-reachable=yes ==2420== ==2420== For counts of detected and suppressed errors, rerun with: -v ==2420== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 13 from 8) 

Is everything okay here? The only thing that concerns me is the still accessible part. This is normal?

Thank you all

+4
source share
3 answers

Selected Output:

== 2420 == total heap usage: 82 allocs, 1 frees, 2,592 bytes allocated

...

== 2420 == still available: 2,240 bytes in 81 blocks

82 distributions and only one free, so at the end there are 81 blocks that are still โ€œreachableโ€ on the heap. As stated in the Valgrind FAQ , this may indicate that the code uses some allocator of the memory pool and, therefore, it does not free the memory as soon as it is not used, but rather saves it for later use, or it may be a memory leak ( unlikely though). Follow the instructions in the link to check if this is related to using STL memory caching.

+7
source

I suggest you stop and read Valgrind's โ€œQuick Startโ€ , paying particular attention to Section 4, โ€œ Interpreting Memcheck Output โ€ and looking at the FAQ .


Later, I think you could use Reading How to Ask Smart Way Questions (aka Smart Questions) to improve your problem solving skills and improve your request for help in community forums such as /fooobar.com / ... , where better questions are rewarded with better answers.

This should not be an insult or a personal attack, but a suggestion on how best to ask questions so that you can get better answers. You will also learn to answer your basic questions more often, accelerating your overall efforts. Good luck.

+6
source

Source: https://habr.com/ru/post/1304596/


All Articles