When I test run C++ programs with the option -fsanitize=address
I see many locations point to an indirect leak. They are all initiated from libasan.so
. The exact error shown below. I am not sure that I am responsible for this leak or not. I was able to fixed other direct leaks in my program.
Indirect leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f24e2b9c947 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10f947)
#1 0x7f24e2517dc8 in __gnu_cxx::new_allocator<std::pair<char, int> >::allocate(unsigned long, void const*) /usr/include/c++/9/ext/new_allocator.h:114
#2 0x7f24e250ed74 in std::allocator_traits<std::allocator<std::pair<char, int> > >::allocate(std::allocator<std::pair<char, int> >&, unsigned long) /usr/include/c++/9/bits/alloc_traits.h:444
#3 0x7f24e24ff853 in std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int> > >::_M_allocate(unsigned long) /usr/include/c++/9/bits/stl_vector.h:343
#4 0x7f24e24e8aa6 in std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int> > >::_M_create_storage(unsigned long) /usr/include/c++/9/bits/stl_vector.h:358
#5 0x7f24e24d8ee8 in std::_Vector_base<std::pair<char, int>, std::allocator<std::pair<char, int> > >::_Vector_base(unsigned long, std::allocator<std::pair<char, int> > const&) /usr/include/c++/9/bits/stl_vector.h:302
#6 0x7f24e24c9782 in std::vector<std::pair<char, int>, std::allocator<std::pair<char, int> > >::vector(std::vector<std::pair<char, int>, std::allocator<std::pair<char, int> > > const&) /usr/include/c++/9/bits/stl_vector.h:552
#7 0x7f24e2579da6 in Hitbrief::Hitbrief(Hitbrief const&) /home/kzhou/coding/molbar/src/readcompass.h:21
#8 0x7f24e2579e5b in std::pair<Hitbrief const, int>::pair<Hitbrief&&, 0ul>(std::tuple<Hitbrief&&>&, std::tuple<>&, std::_Index_tuple<0ul>, std::_Index_tuple<>) /usr/include/c++/9/tuple:1674
#9 0x7f24e25798f0 in std::pair<Hitbrief const, int>::pair<Hitbrief&&>(std::piecewise_construct_t, std::tuple<Hitbrief&&>, std::tuple<>) /usr/include/c++/9/tuple:1663
#10 0x7f24e2578f77 in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<Hitbrief const, int> > >::construct<std::pair<Hitbrief const, int>, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>, std::tuple<> >(std::pair<Hitbrief const, int>*, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>&&, std::tuple<>&&) /usr/include/c++/9/ext/new_allocator.h:147
#11 0x7f24e2577db5 in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<Hitbrief const, int> > > >::construct<std::pair<Hitbrief const, int>, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>, std::tuple<> >(std::allocator<std::_Rb_tree_node<std::pair<Hitbrief const, int> > >&, std::pair<Hitbrief const, int>*, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>&&, std::tuple<>&&) /usr/include/c++/9/bits/alloc_traits.h:484
#12 0x7f24e2575199 in void std::_Rb_tree<Hitbrief, std::pair<Hitbrief const, int>, std::_Select1st<std::pair<Hitbrief const, int> >, std::less<Hitbrief>, std::allocator<std::pair<Hitbrief const, int> > >::_M_construct_node<std::piecewise_construct_t const&, std::tuple<Hitbrief&&>, std::tuple<> >(std::_Rb_tree_node<std::pair<Hitbrief const, int> >*, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>&&, std::tuple<>&&) /usr/include/c++/9/bits/stl_tree.h:614
#13 0x7f24e25714e9 in std::_Rb_tree_node<std::pair<Hitbrief const, int> >* std::_Rb_tree<Hitbrief, std::pair<Hitbrief const, int>, std::_Select1st<std::pair<Hitbrief const, int> >, std::less<Hitbrief>, std::allocator<std::pair<Hitbrief const, int> > >::_M_create_node<std::piecewise_construct_t const&, std::tuple<Hitbrief&&>, std::tuple<> >(std::piecewise_construct_t const&, std::tuple<Hitbrief&&>&&, std::tuple<>&&) /usr/include/c++/9/bits/stl_tree.h:631
#14 0x7f24e256e7ae in std::_Rb_tree_iterator<std::pair<Hitbrief const, int> > std::_Rb_tree<Hitbrief, std::pair<Hitbrief const, int>, std::_Select1st<std::pair<Hitbrief const, int> >, std::less<Hitbrief>, std::allocator<std::pair<Hitbrief const, int> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<Hitbrief&&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<Hitbrief const, int> >, std::piecewise_construct_t const&, std::tuple<Hitbrief&&>&&, std::tuple<>&&) /usr/include/c++/9/bits/stl_tree.h:2455
#15 0x7f24e2568f82 in std::map<Hitbrief, int, std::less<Hitbrief>, std::allocator<std::pair<Hitbrief const, int> > >::operator[](Hitbrief&&) /usr/include/c++/9/bits/stl_map.h:518