mridoni / gixsql

GixSQL is an ESQL preprocessor and a series of runtime libraries to enable GnuCOBOL to access PostgreSQL, ODBC, MySQL, Oracle and SQLite databases.
GNU General Public License v3.0
16 stars 8 forks source link

missing "close" for spdlog? #82

Closed GitMensch closed 2 years ago

GitMensch commented 2 years ago

Not sure if you've added a close function on unloading the module, if not then there possibly is one. If you do and you think that's done correctly then there's either a possible bug in spdlog (which one of us should forward upstream), which is possibly already solved in the newest version or a "by design decission - the OS cleans that at process exit in any case".

I'd like to know what the issue is, and will use a suppression rule for spdlog in the meantime.

Currently valgrind's memcheck --leak-check=full --show-leak-kinds=all says:

==3604263== 8 bytes in 1 blocks are indirectly lost in loss record 5 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB78AAE3: __gnu_cxx::new_allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > >::allocate(unsigned long, void const*) (new_allocator.h:111)
==3604263==    by 0xB785A9A: std::allocator_traits<std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > >::allocate(std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > >&, unsigned long) (alloc_traits.h:436)
==3604263==    by 0xB780677: std::_Vector_base<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >, std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > >::_M_allocate(unsigned long) (stl_vector.h:296)
==3604263==    by 0xB776E2B: void std::vector<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >, std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > >::_M_realloc_insert<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > >(__gnu_cxx::__normal_iterator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >*, std::vector<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >, std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > > >, std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >&&) (vector.tcc:427)
==3604263==    by 0xB77040D: std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >& std::vector<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >, std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > >::emplace_back<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > >(std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >&&) (vector.tcc:109)
==3604263==    by 0xB76B019: std::vector<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >, std::allocator<std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> > > >::push_back(std::unique_ptr<spdlog::details::flag_formatter, std::default_delete<spdlog::details::flag_formatter> >&&) (stl_vector.h:1091)
==3604263==    by 0xB7E7D68: spdlog::pattern_formatter::pattern_formatter(spdlog::pattern_time_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (pattern_formatter-inl.h:995)
==3604263==    by 0xB7EF36A: std::_MakeUniq<spdlog::pattern_formatter>::__single_object std::make_unique<spdlog::pattern_formatter>() (unique_ptr.h:827)
==3604263==    by 0xB7F504A: spdlog::sinks::base_sink<std::mutex>::base_sink() (base_sink-inl.h:17)
==3604263==    by 0xB7F4F9B: spdlog::sinks::basic_file_sink<std::mutex>::basic_file_sink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (basic_file_sink-inl.h:17)
==3604263==    by 0xB7F4CE7: void __gnu_cxx::new_allocator<spdlog::sinks::basic_file_sink<std::mutex> >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (new_allocator.h:136)
==3604263==
==3604263== 32 bytes in 1 blocks are indirectly lost in loss record 16 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB77F8DB: __gnu_cxx::new_allocator<char>::allocate(unsigned long, void const*) (new_allocator.h:111)
==3604263==    by 0xB776125: std::allocator_traits<std::allocator<char> >::allocate(std::allocator<char>&, unsigned long) (alloc_traits.h:436)
==3604263==    by 0xB77F897: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) (basic_string.tcc:153)
==3604263==    by 0xB77629D: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (basic_string.tcc:265)
==3604263==    by 0xB76F6D4: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (basic_string.h:1366)
==3604263==    by 0xB76F1EA: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (basic_string.h:695)
==3604263==    by 0xB7F1E57: spdlog::details::file_helper::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (file_helper-inl.h:31)
==3604263==    by 0xB7F4FD8: spdlog::sinks::basic_file_sink<std::mutex>::basic_file_sink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (basic_file_sink-inl.h:19)
==3604263==    by 0xB7F4CE7: void __gnu_cxx::new_allocator<spdlog::sinks::basic_file_sink<std::mutex> >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (new_allocator.h:136)
==3604263==    by 0xB7F49D3: void std::allocator_traits<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >&, spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (alloc_traits.h:475)
==3604263==    by 0xB7F45DE: std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:545)
==3604263==
==3604263== 32 bytes in 2 blocks are indirectly lost in loss record 17 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB78E07F: __gnu_cxx::new_allocator<std::shared_ptr<spdlog::sinks::sink> >::allocate(unsigned long, void const*) (new_allocator.h:111)
==3604263==    by 0xB789932: std::allocator_traits<std::allocator<std::shared_ptr<spdlog::sinks::sink> > >::allocate(std::allocator<std::shared_ptr<spdlog::sinks::sink> >&, unsigned long) (alloc_traits.h:436)
==3604263==    by 0xB784A89: std::_Vector_base<std::shared_ptr<spdlog::sinks::sink>, std::allocator<std::shared_ptr<spdlog::sinks::sink> > >::_M_allocate(unsigned long) (stl_vector.h:296)
==3604263==    by 0xB7EB4CF: void std::vector<std::shared_ptr<spdlog::sinks::sink>, std::allocator<std::shared_ptr<spdlog::sinks::sink> > >::_M_range_initialize<std::shared_ptr<spdlog::sinks::sink> const*>(std::shared_ptr<spdlog::sinks::sink> const*, std::shared_ptr<spdlog::sinks::sink> const*, std::forward_iterator_tag) (stl_vector.h:1466)
==3604263==    by 0xB7EA120: void std::vector<std::shared_ptr<spdlog::sinks::sink>, std::allocator<std::shared_ptr<spdlog::sinks::sink> > >::_M_initialize_dispatch<std::shared_ptr<spdlog::sinks::sink> const*>(std::shared_ptr<spdlog::sinks::sink> const*, std::shared_ptr<spdlog::sinks::sink> const*, std::__false_type) (stl_vector.h:1437)
==3604263==    by 0xB7E942E: std::vector<std::shared_ptr<spdlog::sinks::sink>, std::allocator<std::shared_ptr<spdlog::sinks::sink> > >::vector<std::shared_ptr<spdlog::sinks::sink> const*, void>(std::shared_ptr<spdlog::sinks::sink> const*, std::shared_ptr<spdlog::sinks::sink> const*, std::allocator<std::shared_ptr<spdlog::sinks::sink> > const&) (stl_vector.h:546)
==3604263==    by 0xB7E88D8: spdlog::logger::logger<std::shared_ptr<spdlog::sinks::sink> const*>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<spdlog::sinks::sink> const*, std::shared_ptr<spdlog::sinks::sink> const*) (logger.h:55)
==3604263==    by 0xB7E7BB0: spdlog::logger::logger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::initializer_list<std::shared_ptr<spdlog::sinks::sink> >) (logger.h:65)
==3604263==    by 0xB7E7ACF: spdlog::logger::logger(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<spdlog::sinks::sink>) (logger.h:60)
==3604263==    by 0x148CFF34: void __gnu_cxx::new_allocator<spdlog::logger>::construct<spdlog::logger, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(spdlog::logger*, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (new_allocator.h:136)
==3604263==    by 0x148CFAD7: void std::allocator_traits<std::allocator<spdlog::logger> >::construct<spdlog::logger, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(std::allocator<spdlog::logger>&, spdlog::logger*, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (alloc_traits.h:475)
==3604263==
==3604263== 128 bytes in 1 blocks are indirectly lost in loss record 36 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB7F4C41: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:111)
==3604263==    by 0xB7F48EE: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:436)
==3604263==    by 0xB7F4471: std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2> >&) (allocated_ptr.h:97)
==3604263==    by 0xB7F3F26: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*&, std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:675)
==3604263==    by 0xB7F3A93: std::__shared_ptr<spdlog::sinks::basic_file_sink<std::mutex>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:1342)
==3604263==    by 0xB7F3672: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> >::shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:359)
==3604263==    by 0xB7F3240: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> > std::allocate_shared<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:706)
==3604263==    by 0xB7F2DA8: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> > std::make_shared<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:722)
==3604263==    by 0xB7F2392: lib_load_handler::lib_load_handler() (dllmain.cpp:40)
==3604263==    by 0xB7F1634: __static_initialization_and_destruction_0(int, int) (dllmain.cpp:102)
==3604263==    by 0xB7F166A: _GLOBAL__sub_I_dllmain.cpp (dllmain.cpp:102)
==3604263==
==3604263== 168 bytes in 1 blocks are indirectly lost in loss record 38 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB7EF357: std::_MakeUniq<spdlog::pattern_formatter>::__single_object std::make_unique<spdlog::pattern_formatter>() (unique_ptr.h:827)
==3604263==    by 0xB7F504A: spdlog::sinks::base_sink<std::mutex>::base_sink() (base_sink-inl.h:17)
==3604263==    by 0xB7F4F9B: spdlog::sinks::basic_file_sink<std::mutex>::basic_file_sink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (basic_file_sink-inl.h:17)
==3604263==    by 0xB7F4CE7: void __gnu_cxx::new_allocator<spdlog::sinks::basic_file_sink<std::mutex> >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (new_allocator.h:136)
==3604263==    by 0xB7F49D3: void std::allocator_traits<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >&, spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (alloc_traits.h:475)
==3604263==    by 0xB7F45DE: std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:545)
==3604263==    by 0xB7F3F7E: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*&, std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:677)
==3604263==    by 0xB7F3A93: std::__shared_ptr<spdlog::sinks::basic_file_sink<std::mutex>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:1342)
==3604263==    by 0xB7F3672: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> >::shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:359)
==3604263==    by 0xB7F3240: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> > std::allocate_shared<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:706)
==3604263==    by 0xB7F2DA8: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> > std::make_shared<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:722)
==3604263==
==3604263== 320 bytes in 1 blocks are indirectly lost in loss record 52 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB7E899C: std::_MakeUniq<spdlog::details::full_formatter>::__single_object std::make_unique<spdlog::details::full_formatter, spdlog::details::padding_info>(spdlog::details::padding_info&&) (unique_ptr.h:827)
==3604263==    by 0xB7E7D46: spdlog::pattern_formatter::pattern_formatter(spdlog::pattern_time_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (pattern_formatter-inl.h:995)
==3604263==    by 0xB7EF36A: std::_MakeUniq<spdlog::pattern_formatter>::__single_object std::make_unique<spdlog::pattern_formatter>() (unique_ptr.h:827)
==3604263==    by 0xB7F504A: spdlog::sinks::base_sink<std::mutex>::base_sink() (base_sink-inl.h:17)
==3604263==    by 0xB7F4F9B: spdlog::sinks::basic_file_sink<std::mutex>::basic_file_sink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (basic_file_sink-inl.h:17)
==3604263==    by 0xB7F4CE7: void __gnu_cxx::new_allocator<spdlog::sinks::basic_file_sink<std::mutex> >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (new_allocator.h:136)
==3604263==    by 0xB7F49D3: void std::allocator_traits<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >&, spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (alloc_traits.h:475)
==3604263==    by 0xB7F45DE: std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:545)
==3604263==    by 0xB7F3F7E: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*&, std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:677)
==3604263==    by 0xB7F3A93: std::__shared_ptr<spdlog::sinks::basic_file_sink<std::mutex>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:1342)
==3604263==    by 0xB7F3672: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> >::shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:359)
==3604263==
==3604263== 448 bytes in 2 blocks are indirectly lost in loss record 54 of 81
==3604263==    at 0x4C3276F: operator new(unsigned long) (vg_replace_malloc.c:422)
==3604263==    by 0xB79647B: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:111)
==3604263==    by 0xB7929BC: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:436)
==3604263==    by 0xB78E0FB: std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<spdlog::logger, std::allocator<spdlog::logger>, (__gnu_cxx::_Lock_policy)2> >&) (allocated_ptr.h:97)
==3604263==    by 0x148CE717: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<spdlog::logger, std::allocator<spdlog::logger>, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(spdlog::logger*&, std::_Sp_alloc_shared_tag<std::allocator<spdlog::logger> >, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (shared_ptr_base.h:675)
==3604263==    by 0x148CD435: std::__shared_ptr<spdlog::logger, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<spdlog::logger>, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::logger> >, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (shared_ptr_base.h:1342)
==3604263==    by 0x148CA32E: std::shared_ptr<spdlog::logger>::shared_ptr<std::allocator<spdlog::logger>, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::logger> >, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (shared_ptr.h:359)
==3604263==    by 0x148C8BE1: std::shared_ptr<spdlog::logger> std::allocate_shared<spdlog::logger, std::allocator<spdlog::logger>, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(std::allocator<spdlog::logger> const&, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (shared_ptr.h:706)
==3604263==    by 0x148C75E8: std::shared_ptr<spdlog::logger> std::make_shared<spdlog::logger, char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&>(char const (&) [16], std::shared_ptr<spdlog::sinks::sink>&) (shared_ptr.h:722)
==3604263==    by 0x148C2320: DbInterfacePGSQL::init(std::shared_ptr<spdlog::logger> const&) (DbInterfacePGSQL.cpp:56)
==3604263==    by 0xB7E6FCD: DbInterfaceFactory::load_dblib(char const*) (DbInterfaceFactory.cpp:178)
==3604263==    by 0xB7E6CF0: DbInterfaceFactory::getInterface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<spdlog::logger> const&) (DbInterfaceFactory.cpp:80)
==3604263==
==3604263== 488 bytes in 1 blocks are still reachable in loss record 55 of 81
==3604263==    at 0x4C32001: malloc (vg_replace_malloc.c:381)
==3604263==    by 0x5A1C3BE: __fopen_internal (in /usr/lib64/libc-2.28.so)
==3604263==    by 0xB7F184F: spdlog::details::os::fopen_s(_IO_FILE**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (os-inl.h:156)
==3604263==    by 0xB7F1F3C: spdlog::details::file_helper::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (file_helper-inl.h:38)
==3604263==    by 0xB7F4FD8: spdlog::sinks::basic_file_sink<std::mutex>::basic_file_sink(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) (basic_file_sink-inl.h:19)
==3604263==    by 0xB7F4CE7: void __gnu_cxx::new_allocator<spdlog::sinks::basic_file_sink<std::mutex> >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (new_allocator.h:136)
==3604263==    by 0xB7F49D3: void std::allocator_traits<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >::construct<spdlog::sinks::basic_file_sink<std::mutex>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >&, spdlog::sinks::basic_file_sink<std::mutex>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (alloc_traits.h:475)
==3604263==    by 0xB7F45DE: std::_Sp_counted_ptr_inplace<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:545)
==3604263==    by 0xB7F3F7E: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(spdlog::sinks::basic_file_sink<std::mutex>*&, std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:677)
==3604263==    by 0xB7F3A93: std::__shared_ptr<spdlog::sinks::basic_file_sink<std::mutex>, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr_base.h:1342)
==3604263==    by 0xB7F3672: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> >::shared_ptr<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::_Sp_alloc_shared_tag<std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:359)
==3604263==    by 0xB7F3240: std::shared_ptr<spdlog::sinks::basic_file_sink<std::mutex> > std::allocate_shared<spdlog::sinks::basic_file_sink<std::mutex>, std::allocator<spdlog::sinks::basic_file_sink<std::mutex> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::allocator<spdlog::sinks::basic_file_sink<std::mutex> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (shared_ptr.h:706)
==3604263==
mridoni commented 2 years ago

Yes, I noticed that sometimes the log was truncated, so I added a “flush” call in my internal repository, but having a better look at the docs, a “shutdown” call is also needed (look here: https://spdlog.docsforge.com/v1.x/0.faq/#memory-leak-detected-when-using-inside-a-shared-library)

GitMensch commented 2 years ago

fixed (per release notes - shutdown is now called in the destructor)