https://bugs.kde.org/show_bug.cgi?id=371471

            Bug ID: 371471
           Summary: Valgrind complains about non legit memory leaks on
                    placement new (C++)
           Product: valgrind
           Version: 3.11.0
          Platform: unspecified
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: brian.teixe...@epita.fr

Created attachment 101697
  --> https://bugs.kde.org/attachment.cgi?id=101697&action=edit
C++ code used and valgrind -v output

When using placement new in C++, as object is constructed in allocated storage,
this should not leak. However, valgrind complains about memory leaks, and says
there are 2 allocs and 1 free.

Yet here is the output of `ltrace -e malloc+free`

libstdc++.so.6->malloc(4)                                                      
                                     = 0x55bd51c93c20
libstdc++.so.6->free(0x55bd51c93c20)                                           
                                     = <void>
+++ exited (status 0) +++

You can find the code I used in attachment, compiled with g++ 6.2 with
-std=c++14.

Here is the output of `uname -a` :

Linux Infinity 4.4.0-30-generic #49-Ubuntu SMP Thu Jun 30 20:51:32 UTC 2016
x86_64 x86_64 x86_64 GNU/Linux

The output of `valgrind -v` may also be found in attachment.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to