]> git.ipfire.org Git - thirdparty/valgrind.git/commit
add heuristics decreasing false possible "possible leaks" in c++ code.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 29 Sep 2013 13:47:32 +0000 (13:47 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 29 Sep 2013 13:47:32 +0000 (13:47 +0000)
commite2ba2f3671e35a20bf92b7a223e86530c261ac6e
tree5cecf676d2bca433af52f35dd7927e4a7d304c2e
parent8e32b20d458e5266cda8841f95173ca00d2d42c0
add heuristics decreasing false possible "possible leaks" in c++ code.

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
NEWS
gdbserver_tests/mchelp.stdoutB.exp
memcheck/docs/mc-manual.xml
memcheck/mc_include.h
memcheck/mc_leakcheck.c
memcheck/mc_main.c
memcheck/tests/Makefile.am
memcheck/tests/leak_cpp_interior.cpp [new file with mode: 0644]
memcheck/tests/leak_cpp_interior.stderr.exp [new file with mode: 0644]
memcheck/tests/leak_cpp_interior.stderr.exp-64bit [new file with mode: 0644]
memcheck/tests/leak_cpp_interior.vgtest [new file with mode: 0644]