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 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index 306c3a4..b6b3d8f 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,13 @@
     This is a.o. useful to avoid definite leaks being "catched"
     by a suppression entry aimed at suppressing possibly lost blocks.
 
+  - 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.
+
   - The option --keep-stacktraces controls which stack trace(s) to keep for
     malloc'd and/or free'd blocks. This can be used to obtain more information
     for 'use after free' errors or to decrease Valgrind memory and/or cpu usage
@@ -93,6 +100,7 @@
 274695    [390] s390x: Support "compare to/from logical" instructions (z196)
 275800    [390] s390x: Add support for the ecag instruction (part 1)
 275800    [390] s390x: Autodetect cache info (part 2)
+280271    Valgrind reports possible memory leaks on still-reachable std::string
 284540    [390] Memcheck shouldn't count suppressions matching still-reachable allocations
 296311    [390] Wrong stack traces due to -fomit-frame-pointer (x86)