https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87840
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2018-11-01 Ever confirmed|0 |1 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- for GCC 7, 8 and current trunk I see: $ g++ pr87840.cpp -fsanitize=leak -g && ./a.out ================================================================= ==31759==ERROR: LeakSanitizer: detected memory leaks Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x7ffff74fa7db in operator new(unsigned long) /home/marxin/Programming/gcc/libsanitizer/lsan/lsan_interceptors.cc:222 #1 0x401c23 in __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /home/marxin/bin/gcc/include/c++/9.0.0/ext/new_allocator.h:114 #2 0x401ac2 in std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /home/marxin/bin/gcc/include/c++/9.0.0/bits/alloc_traits.h:444 #3 0x40190b in std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<S, std::allocator<S>, (__gnu_cxx::_Lock_policy)2> >&) /home/marxin/bin/gcc/include/c++/9.0.0/bits/allocated_ptr.h:97 #4 0x4017af in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<S, std::allocator<S>>(std::_Sp_make_shared_tag, S*, std::allocator<S> const&) /home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:655 #5 0x4016e8 in std::__shared_ptr<S, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag, std::allocator<S> const&) /home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr_base.h:1322 #6 0x401658 in std::shared_ptr<S>::shared_ptr<std::allocator<S>>(std::_Sp_make_shared_tag, std::allocator<S> const&) /home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:360 #7 0x40155d in std::shared_ptr<S> std::allocate_shared<S, std::allocator<S>>(std::allocator<S> const&) /home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:703 #8 0x401424 in std::shared_ptr<S> std::make_shared<S>() /home/marxin/bin/gcc/include/c++/9.0.0/bits/shared_ptr.h:719 #9 0x4011ab in main /home/marxin/Programming/testcases/pr87840.cpp:7 #10 0x7ffff6db8fea in __libc_start_main ../csu/libc-start.c:308 SUMMARY: LeakSanitizer: 32 byte(s) leaked in 1 allocation(s). I hope it's the leak you're seeking for?