Looks like most of the leaks are gone, thanks! But I'm still seeing problems. About one in every 10-15 runs of the load test on my 8-core Vivid machine, I get the output below from valgrind. Looks like there is a race condition somewhere.
==13111==
==13111== HEAP SUMMARY:
==13111== in use at exit: 174,592 bytes in 1,968 blocks
==13111== total heap usage: 317,581 allocs, 315,613 frees, 54,709,429 bytes allocated
==13111==
==13111== 174,528 (81 direct, 174,447 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 65
==13111== at 0x4C2B100: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13111== by 0x4E878E7: boost::asio::detail::thread_info_base::allocate(boost::asio::detail::thread_info_base*, unsigned long) (thread_info_base.hpp:60)
==13111== by 0x4E879F6: boost::asio::asio_handler_allocate(unsigned long, ...) (handler_alloc_hook.ipp:50)
==13111== by 0x4E855F0: void* boost_asio_handler_alloc_helpers::allocate<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}>(unsigned long, curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}&) (handler_alloc_helpers.hpp:37)
==13111== by 0x4E8513C: void boost::asio::detail::deadline_timer_service<boost::asio::time_traits<boost::posix_time::ptime> >::async_wait<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}>(boost::asio::detail::deadline_timer_service<boost::asio::time_traits<boost::posix_time::ptime> >::implementation_type&, curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}&) (deadline_timer_service.hpp:185)
==13111== by 0x4E84E71: boost::asio::async_result<boost::asio::handler_type<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}, void (boost::system::error_code)>::type>::type boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> >::async_wait<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}>(boost::asio::detail::deadline_timer_service<boost::asio::time_traits<boost::posix_time::ptime> >::implementation_type&, boost::asio::handler_type&&) (deadline_timer_service.hpp:149)
==13111== by 0x4E84D63: boost::asio::async_result<boost::asio::handler_type<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}, void (boost::system::error_code)>::type>::type boost::asio::basic_deadline_timer<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime>, boost::asio::deadline_timer_service<boost::posix_time::ptime, boost::asio::time_traits<boost::posix_time::ptime> > >::async_wait<curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)::{lambda(boost::system::error_code const&)#1}>(boost::asio::handler_type&&) (basic_deadline_timer.hpp:508)
==13111== by 0x4E83CC8: curl::multi::Handle::Private::Timeout::Private::async_wait_for(std::weak_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&) (multi.cpp:400)
==13111== by 0x4E83A02: curl::multi::Handle::Private::Timeout::async_wait_for(std::shared_ptr<curl::multi::Handle::Private> const&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&) (multi.cpp:371)
==13111== by 0x4E83EA7: curl::multi::Handle::Private::timer_callback(void*, long, void*) (multi.cpp:434)
==13111== by 0x656B204: ??? (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0)
==13111== by 0x656E5F7: curl_multi_socket_action (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0)
==13111==
==13111== LEAK SUMMARY:
==13111== definitely lost: 81 bytes in 1 blocks
==13111== indirectly lost: 174,447 bytes in 1,965 blocks
==13111== possibly lost: 0 bytes in 0 blocks
==13111== still reachable: 64 bytes in 2 blocks
==13111== suppressed: 0 bytes in 0 blocks
==13111== Reachable blocks (those to which a pointer was found) are not shown.
==13111== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==13111==
==13111== For counts of detected and suppressed errors, rerun with: -v
==13111== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Looks like most of the leaks are gone, thanks! But I'm still seeing problems. About one in every 10-15 runs of the load test on my 8-core Vivid machine, I get the output below from valgrind. Looks like there is a race condition somewhere.
==13111== valgrind/ vgpreload_ memcheck- amd64-linux. so) asio::detail: :thread_ info_base: :allocate( boost:: asio::detail: :thread_ info_base* , unsigned long) (thread_ info_base. hpp:60) asio::asio_ handler_ allocate( unsigned long, ...) (handler_ alloc_hook. ipp:50) handler_ alloc_helpers: :allocate< curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(unsigned long, curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}&) (handler_ alloc_helpers. hpp:37) asio::detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::async_ wait<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(boost: :asio:: detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::implementati on_type& , curl::multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}&) (deadline_ timer_service. hpp:185) asio::async_ result< boost:: asio::handler_ type<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}, void (boost: :system: :error_ code)>: :type>: :type boost:: asio::deadline_ timer_service< boost:: posix_time: :ptime, boost:: asio::time_ traits< boost:: posix_time: :ptime> >::async_ wait<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(boost: :asio:: detail: :deadline_ timer_service< boost:: asio::time_ traits< boost:: posix_time: :ptime> >::implementati on_type& , boost:: asio::handler_ type&&) (deadline_ timer_service. hpp:149) asio::async_ result< boost:: asio::handler_ type<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&)#1}, void (boost: :system: :error_ code)>: :type>: :type boost:: asio::basic_ deadline_ timer<boost: :posix_ time::ptime, boost:: asio::time_ traits< boost:: posix_time: :ptime> , boost:: asio::deadline_ timer_service< boost:: posix_time: :ptime, boost:: asio::time_ traits< boost:: posix_time: :ptime> > >::async_ wait<curl: :multi: :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) ::{lambda( boost:: system: :error_ code const&) #1}>(boost: :asio:: handler_ type&&) (basic_ deadline_ timer.hpp: 508) :Handle: :Private: :Timeout: :Private: :async_ wait_for( std::weak_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) (multi.cpp:400) :Handle: :Private: :Timeout: :async_ wait_for( std::shared_ ptr<curl: :multi: :Handle: :Private> const&, std::chrono: :duration< long, std::ratio<1l, 1000l> > const&) (multi.cpp:371) :Handle: :Private: :timer_ callback( void*, long, void*) (multi.cpp:434) x86_64- linux-gnu/ libcurl. so.4.3. 0) socket_ action (in /usr/lib/ x86_64- linux-gnu/ libcurl. so.4.3. 0) leak-kinds= all
==13111== HEAP SUMMARY:
==13111== in use at exit: 174,592 bytes in 1,968 blocks
==13111== total heap usage: 317,581 allocs, 315,613 frees, 54,709,429 bytes allocated
==13111==
==13111== 174,528 (81 direct, 174,447 indirect) bytes in 1 blocks are definitely lost in loss record 65 of 65
==13111== at 0x4C2B100: operator new(unsigned long) (in /usr/lib/
==13111== by 0x4E878E7: boost::
==13111== by 0x4E879F6: boost::
==13111== by 0x4E855F0: void* boost_asio_
==13111== by 0x4E8513C: void boost::
==13111== by 0x4E84E71: boost::
==13111== by 0x4E84D63: boost::
==13111== by 0x4E83CC8: curl::multi:
==13111== by 0x4E83A02: curl::multi:
==13111== by 0x4E83EA7: curl::multi:
==13111== by 0x656B204: ??? (in /usr/lib/
==13111== by 0x656E5F7: curl_multi_
==13111==
==13111== LEAK SUMMARY:
==13111== definitely lost: 81 bytes in 1 blocks
==13111== indirectly lost: 174,447 bytes in 1,965 blocks
==13111== possibly lost: 0 bytes in 0 blocks
==13111== still reachable: 64 bytes in 2 blocks
==13111== suppressed: 0 bytes in 0 blocks
==13111== Reachable blocks (those to which a pointer was found) are not shown.
==13111== To see them, rerun with: --leak-check=full --show-
==13111==
==13111== For counts of detected and suppressed errors, rerun with: -v
==13111== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)