mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
The option --leak-check-heuristics=heur1,heur2,... can activate various heuristics to decrease the number of false positive "possible leaks" for C++ code. The available heuristics are detecting valid interior pointers to std::stdstring, to new[] allocated arrays with elements having destructors and to interior pointers pointing to an inner part of a C++ object using multiple inheritance. This fixes 280271 Valgrind reports possible memory leaks on still-reachable std::string This has been tested on x86/amd64/ppc32/ppc64. First performance measurements seems to show a neglectible impact on the leak search. More feedback welcome both on performance and functional aspects (false positive 'possibly leaked' rate decrease and/or false negative 'possibly leaked' rate increase). Note that the heuristic is not checking that the memory has been allocated with "new" or "new[]", as it is expected that in some cases, specific alloc fn are used for c++ objects instead of the standard new/new[]. If needed, we might add an option to check the alloc functions to be new/new[]. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13582
82 lines
3.0 KiB
Plaintext
82 lines
3.0 KiB
Plaintext
|
|
valgrind output will go to log
|
|
VALGRIND_DO_LEAK_CHECK
|
|
8 bytes in 1 blocks are definitely lost in loss record ... of ...
|
|
by 0x........: main (leak_cpp_interior.cpp:72)
|
|
|
|
LEAK SUMMARY:
|
|
definitely lost: 8 bytes in 1 blocks
|
|
indirectly lost: 0 bytes in 0 blocks
|
|
possibly lost: 0 bytes in 0 blocks
|
|
still reachable: 187 bytes in 7 blocks
|
|
of which reachable via heuristic:
|
|
stdstring : 80 bytes in 2 blocks
|
|
newarray : 11 bytes in 1 blocks
|
|
multipleinheritance: 48 bytes in 2 blocks
|
|
suppressed: 0 bytes in 0 blocks
|
|
Reachable blocks (those to which a pointer was found) are not shown.
|
|
To see them, rerun with: --leak-check=full --show-leak-kinds=all
|
|
|
|
leak_check summary heuristics multipleinheritance
|
|
LEAK SUMMARY:
|
|
definitely lost: 8 (+0) bytes in 1 (+0) blocks
|
|
indirectly lost: 0 (+0) bytes in 0 (+0) blocks
|
|
possibly lost: 91 (+91) bytes in 3 (+3) blocks
|
|
still reachable: 96 (-91) bytes in 4 (-3) blocks
|
|
of which reachable via heuristic:
|
|
stdstring : 0 (-80) bytes in 0 (-2) blocks
|
|
newarray : 0 (-11) bytes in 0 (-1) blocks
|
|
multipleinheritance: 48 (+0) bytes in 2 (+0) blocks
|
|
suppressed: 0 (+0) bytes in 0 (+0) blocks
|
|
To see details of leaked memory, give 'full' arg to leak_check
|
|
|
|
leak_check summary any heuristics newarray
|
|
LEAK SUMMARY:
|
|
definitely lost: 8 (+0) bytes in 1 (+0) blocks
|
|
indirectly lost: 0 (+0) bytes in 0 (+0) blocks
|
|
possibly lost: 128 (+37) bytes in 4 (+1) blocks
|
|
still reachable: 59 (-37) bytes in 3 (-1) blocks
|
|
of which reachable via heuristic:
|
|
newarray : 11 (+11) bytes in 1 (+1) blocks
|
|
multipleinheritance: 0 (-48) bytes in 0 (-2) blocks
|
|
suppressed: 0 (+0) bytes in 0 (+0) blocks
|
|
To see details of leaked memory, give 'full' arg to leak_check
|
|
|
|
leak_check summary heuristics stdstring
|
|
LEAK SUMMARY:
|
|
definitely lost: 8 (+0) bytes in 1 (+0) blocks
|
|
indirectly lost: 0 (+0) bytes in 0 (+0) blocks
|
|
possibly lost: 59 (-69) bytes in 3 (-1) blocks
|
|
still reachable: 128 (+69) bytes in 4 (+1) blocks
|
|
of which reachable via heuristic:
|
|
stdstring : 80 (+80) bytes in 2 (+2) blocks
|
|
newarray : 0 (-11) bytes in 0 (-1) blocks
|
|
suppressed: 0 (+0) bytes in 0 (+0) blocks
|
|
To see details of leaked memory, give 'full' arg to leak_check
|
|
|
|
destruct MyClass
|
|
destruct MyClass
|
|
destruct MyClass
|
|
destruct Ce
|
|
destruct Be
|
|
destruct Ae
|
|
destruct Ce
|
|
destruct Be
|
|
destruct Ae
|
|
destruct C
|
|
destruct B
|
|
destruct A
|
|
destruct C
|
|
destruct B
|
|
destruct A
|
|
Finished!
|
|
|
|
HEAP SUMMARY:
|
|
in use at exit: 0 bytes in 0 blocks
|
|
total heap usage: 8 allocs, 8 frees, 195 bytes allocated
|
|
|
|
All heap blocks were freed -- no leaks are possible
|
|
|
|
For counts of detected and suppressed errors, rerun with: -v
|
|
ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
|