Segfeing only without valgrind

I get my final "done" message with valgrind and get this exit report:

==3434== HEAP SUMMARY: ==3434== in use at exit: 8,432 bytes in 4 blocks ==3434== total heap usage: 4,369 allocs, 8,037 frees, 377,356 bytes allocated ==3434== ==3434== LEAK SUMMARY: ==3434== definitely lost: 152 bytes in 1 blocks ==3434== indirectly lost: 0 bytes in 0 blocks ==3434== possibly lost: 0 bytes in 0 blocks ==3434== still reachable: 8,192 bytes in 2 blocks ==3434== suppressed: 88 bytes in 1 blocks ==3434== Rerun with --leak-check=full to see details of leaked memory ==3434== ==3434== For counts of detected and suppressed errors, rerun with: -v ==3434== ERROR SUMMARY: 100190 errors from 140 contexts (suppressed: 0 from 0) 

But when I run it without valgrind, it disappears immediately. Does valgrind really suppress the specific error I should look for? I can not find information about this online

+6
source share
3 answers

Valgrind runs the program in a different environment than if you run it from the shell. This can prevent some crashes related to memory exhaustion or array bending.

Correct 140 error contexts and everything will be fine.

+4
source

Memcheck does not check for full boundaries and, since it has its own memory allocator, it can suppress errors that you would otherwise receive. Use a debugger instead.

+3
source

One example of an error that sometimes does not fall into Valgrind is when you free memory and then reference it with another pointer that also points to the same place.

I do not know why this is happening. Valgrind might handle memory allocation and freeing differently. [As Eredritus says]

A quick way to check this out is to temporarily comment on the calls to the free () functions and see if this is all happening. [Uncover them later as soon as you fix them!]

+1
source

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


All Articles