What is the proper way to destruct a global logger?
We get valgrind errors on program termination.
==330953== 16 bytes in 1 blocks are still reachable in loss record 3 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE0923: boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D80306: boost::log::v2_mt_posix::sources::aux::get_severity_level() (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 8 bytes in 1 blocks are still reachable in loss record 1 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4D845A9: boost::log::v2_mt_posix::aux::this_thread::get_id() (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== by 0x4D7581A: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 24 bytes in 1 blocks are still reachable in loss record 4 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE0791: boost::detail::make_external_thread_data() (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4EE12A8: boost::detail::set_tss_data(void const, void ()(void ()(void), void), void ()(void), void, bool) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D75875: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 312 bytes in 1 blocks are still reachable in loss record 6 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE061B: boost::detail::make_external_thread_data() (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4EE12A8: boost::detail::set_tss_data(void const, void ()(void ()(void), void), void ()(void), void, bool) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D75875: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is the proper way to destruct a global logger?
There isn't one. Global loggers are destroyed when global destructors are called. Valgrind generates its report at this stage too, which is why it may list those allocations. Ignore those records.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What is the proper way to destruct a global logger?
We get valgrind errors on program termination.
==330953== 16 bytes in 1 blocks are still reachable in loss record 3 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE0923: boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D80306: boost::log::v2_mt_posix::sources::aux::get_severity_level() (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 8 bytes in 1 blocks are still reachable in loss record 1 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4D845A9: boost::log::v2_mt_posix::aux::this_thread::get_id() (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== by 0x4D7581A: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 24 bytes in 1 blocks are still reachable in loss record 4 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE0791: boost::detail::make_external_thread_data() (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4EE12A8: boost::detail::set_tss_data(void const, void ()(void ()(void), void), void ()(void), void, bool) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D75875: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
==330953== 312 bytes in 1 blocks are still reachable in loss record 6 of 6
==330953== at 0x48468D5: operator new(unsigned long) (vg_replace_malloc.c:422)
==330953== by 0x4EE061B: boost::detail::make_external_thread_data() (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4EE12A8: boost::detail::set_tss_data(void const, void ()(void ()(void), void), void ()(void), void, bool) (in /usr/local/lib/libboost_thread.so.1.77.0)
==330953== by 0x4D75875: boost::log::v2_mt_posix::core::get_thread_attributes() const (in /usr/local/lib/libboost_log.so.1.77.0)
There isn't one. Global loggers are destroyed when global destructors are called. Valgrind generates its report at this stage too, which is why it may list those allocations. Ignore those records.