Closed killenb closed 4 years ago
The leak was detected in ChimeraTK-ControlSystemAdapter-Analysis #613 based on the ChimeraTK-ControlSystemAdapter #995. With ChimeraTK-ControlSystemAdapter #996 the leak is gone. ChimeraTK-ControlSystemAdapter-Analysis #614 is based on ChimeraTK-ControlSystemAdapter #999 still without a leak.
================================================================= ==2363==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 128 byte(s) in 2 object(s) allocated from:
#1 0x918ba3 in __gnu_cxx::new_allocator<boost::lockfree::queue<ChimeraTK::PVManager::ControlSystemSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:104:27
#2 0x918ba3 in void boost::lockfree::detail::freelist_stack<boost::lockfree::queue<ChimeraTK::PVManager::ControlSystemSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node, std::allocator<boost::lockfree::queue<ChimeraTK::PVManager::ControlSystemSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node> >::reserve<false>(unsigned long) /usr/include/boost/lockfree/detail/freelist.hpp:70
Direct leak of 64 byte(s) in 1 object(s) allocated from:
#1 0x91c593 in __gnu_cxx::new_allocator<boost::lockfree::queue<ChimeraTK::PVManager::DeviceSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:104:27
#2 0x91c593 in void boost::lockfree::detail::freelist_stack<boost::lockfree::queue<ChimeraTK::PVManager::DeviceSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node, std::allocator<boost::lockfree::queue<ChimeraTK::PVManager::DeviceSendNotificationListenerImpl*, boost::parameter::void_, boost::parameter::void_, boost::parameter::void_>::node> >::reserve<false>(unsigned long) /usr/include/boost/lockfree/detail/freelist.hpp:70
Now i am using boost::thread_guard<> to join the thread if joinable when destroyed.
But maybe the problem is in PVManager.h, there are boost::lockfree::queue<DeviceSendNotificationListenerImpl*> _controlSystemNotificationQueue;
I think you found the issue. I guess the solution is still not 100 % clean because the tread is still alive after the pv-Manager is already out of scope. I will quickly fix that.
Wow, I noticed that the whole callable is out of already scope when used. Maybe it's already ok because the callable is copied into the thread. But better safe than sorry.
The address sanitizer in jenkins is reporting a memory leak. Please check and resolve.