Opened 5 years ago
Last modified 5 years ago
#13408 assigned Support Requests
Boost Library Possible memory Leak
Reported by: | anonymous | Owned by: | viboes |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.63.0 | Severity: | Problem |
Keywords: | Cc: |
Description (last modified by )
Hi,
We have been using Boost library in the project. I've made analysis by using Valgrind tool to be able to find possible memory leaks. According to the result, there is a memory leak in Boost library.
==7535== 24 bytes in 1 blocks are still reachable in loss record 2 of 6 ==7535== at 0x4C2B0E0: operator new(unsigned long) (vg_replace_malloc.c:324) ==7535== by 0x4E430A3: boost::detail::make_external_thread_data() (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x4E433DB: boost::detail::add_new_tss_node(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*) (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x4E4408C: boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool) (in /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.55.0) ==7535== by 0x54CAC0C: boost::log::v2_mt_posix::core::add_thread_attribute(boost::log::v2_mt_posix::attribute_name const&, boost::log::v2_mt_posix::attribute const&)
It seems like the allocated memory is not deallocated, so it causes memory leak. Here is the definition of relevant event ;
thread_data_base* make_external_thread_data() { thread_data_base* const me(detail::heap_new<externally_launched_thread>()); me->self.reset(me); set_current_thread_data(me); return me; } thread_data_base* get_or_make_current_thread_data() { thread_data_base* current_thread_data(get_current_thread_data()); if(!current_thread_data) { current_thread_data=make_external_thread_data(); } return current_thread_data; }
I've made some research if there is any post which states that this event causes memory leak, but could not find any. Is there any fix for the problem stated above? If there is any, could you please state the relevant patch ?
Thanks in advance,
Kind Regards
Change History (7)
comment:1 by , 5 years ago
Component: | None → thread |
---|---|
Owner: | set to |
comment:2 by , 5 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
comment:3 by , 5 years ago
comment:4 by , 5 years ago
This is allocated for native threads that are using the Boost.Thread API.
Could you check if the program is calling to tls_destructor
before/after doing the report?
extern "C" { static void tls_destructor(void* data)
Wondering if this isn't associated to some DLL issues.
comment:5 by , 5 years ago
Status: | new → assigned |
---|
comment:7 by , 5 years ago
Type: | Bugs → Support Requests |
---|
Moved to support until we know that the threads are finished and joined before valgrind report.
Are you sure your thread has been joined?