Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak because SubscriptionTopicStatistics not destroyed #1300

Closed
iuhilnehc-ynos opened this issue Sep 11, 2020 · 0 comments · Fixed by #1301
Closed

memory leak because SubscriptionTopicStatistics not destroyed #1300

iuhilnehc-ynos opened this issue Sep 11, 2020 · 0 comments · Fixed by #1301

Comments

@iuhilnehc-ynos
Copy link
Collaborator

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • rmw_fastrtps_cpp
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

$ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug --packages-up-to rclcpp
$ . install/setup.bash
$ valgrind --leak-check=full ./build/rclcpp/test/test_create_subscription --gtest_filter=*create_with_statistics

Expected behavior

No memory leak

Actual behavior

memory leak log

==1596863== 
==1596863== HEAP SUMMARY:
==1596863==     in use at exit: 1,556,890 bytes in 1,094 blocks
==1596863==   total heap usage: 8,463 allocs, 7,369 frees, 4,402,744 bytes allocated
==1596863== 
==1596863== 2 bytes in 1 blocks are possibly lost in loss record 2 of 500
==1596863==    at 0x483D7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x50B1F46: __default_allocate (allocator.c:37)
==1596863==    by 0x50BBB73: rcutils_strndup (strdup.c:48)
==1596863==    by 0x50BBB05: rcutils_strdup (strdup.c:37)
==1596863==    by 0x50765BA: rcl_init (init.c:172)
==1596863==    by 0x4D99128: rclcpp::Context::init(int, char const* const*, rclcpp::InitOptions const&) (context.cpp:204)
==1596863==    by 0x4F1AB61: rclcpp::init(int, char const* const*, rclcpp::InitOptions const&) (utilities.cpp:34)
==1596863==    by 0x1A7E69: TestCreateSubscription::SetUp() (test_create_subscription.cpp:32)
==1596863==    by 0x21B79D: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1596863==    by 0x21432E: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==1596863==    by 0x1F032C: testing::Test::Run() (gtest.cc:2517)
==1596863==    by 0x1F0D96: testing::TestInfo::Run() (gtest.cc:2703)
==1596863== 
==1596863== 2 bytes in 1 blocks are possibly lost in loss record 3 of 500
==1596863==    at 0x483D7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x50B1F46: __default_allocate (allocator.c:37)
==1596863==    by 0x50BBB73: rcutils_strndup (strdup.c:48)
==1596863==    by 0x50BBB05: rcutils_strdup (strdup.c:37)
==1596863==    by 0x5F5AB94: rmw_fastrtps_shared_cpp::rmw_init_options_copy(char const*, rmw_init_options_t const*, rmw_init_options_t*) (rmw_init.cpp:74)
==1596863==    by 0x5E8B678: rmw_init_options_copy (rmw_init.cpp:60)
==1596863==    by 0x553E144: rmw_init_options_copy (functions.cpp:163)
==1596863==    by 0x5E8BC2F: rmw_init (rmw_init.cpp:114)
==1596863==    by 0x554051B: rmw_init (functions.cpp:670)
==1596863==    by 0x50767A8: rcl_init (init.c:214)
==1596863==    by 0x4D99128: rclcpp::Context::init(int, char const* const*, rclcpp::InitOptions const&) (context.cpp:204)
==1596863==    by 0x4F1AB61: rclcpp::init(int, char const* const*, rclcpp::InitOptions const&) (utilities.cpp:34)
==1596863== 
==1596863== 24 bytes in 1 blocks are possibly lost in loss record 142 of 500
==1596863==    at 0x483DE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x5F3EFAB: __create_participant(char const*, eprosima::fastrtps::ParticipantAttributes, bool, rmw_dds_common::Context*) (participant.cpp:119)
==1596863==    by 0x5F3FD2C: rmw_fastrtps_shared_cpp::create_participant(char const*, unsigned long, rmw_security_options_t const*, bool, char const*, rmw_dds_common::Context*) (participant.cpp:254)
==1596863==    by 0x5E73532: init_context_impl(rmw_context_t*) (init_rmw_context_impl.cpp:74)
==1596863==    by 0x5E73C6F: rmw_fastrtps_cpp::increment_context_impl_ref_count(rmw_context_t*) (init_rmw_context_impl.cpp:195)
==1596863==    by 0x5E8DF01: rmw_create_node (rmw_node.cpp:60)
==1596863==    by 0x553E31E: rmw_create_node (functions.cpp:188)
==1596863==    by 0x507C3A3: rcl_node_init (node.c:257)
==1596863==    by 0x4E0B38A: rclcpp::node_interfaces::NodeBase::NodeBase(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&, std::shared_ptr<rclcpp::Context>, rcl_node_options_t const&, bool, bool) (node_base.cpp:76)
==1596863==    by 0x4DFA212: rclcpp::Node::Node(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&, rclcpp::NodeOptions const&) (node.cpp:107)
==1596863==    by 0x1B70C9: void __gnu_cxx::new_allocator<rclcpp::Node>::construct<rclcpp::Node, char const (&) [8], char const (&) [4]>(rclcpp::Node*, char const (&) [8], char const (&) [4]) (new_allocator.h:147)
==1596863==    by 0x1B4E97: void std::allocator_traits<std::allocator<rclcpp::Node> >::construct<rclcpp::Node, char const (&) [8], char const (&) [4]>(std::allocator<rclcpp::Node>&, rclcpp::Node*, char const (&) [8], char const (&) [4]) (alloc_traits.h:484)
==1596863== 
==1596863== 72 bytes in 1 blocks are possibly lost in loss record 231 of 500
==1596863==    at 0x483E0F3: operator new(unsigned long, std::nothrow_t const&) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x5E8BABB: rmw_init (rmw_init.cpp:104)
==1596863==    by 0x554051B: rmw_init (functions.cpp:670)
==1596863==    by 0x50767A8: rcl_init (init.c:214)
==1596863==    by 0x4D99128: rclcpp::Context::init(int, char const* const*, rclcpp::InitOptions const&) (context.cpp:204)
==1596863==    by 0x4F1AB61: rclcpp::init(int, char const* const*, rclcpp::InitOptions const&) (utilities.cpp:34)
==1596863==    by 0x1A7E69: TestCreateSubscription::SetUp() (test_create_subscription.cpp:32)
==1596863==    by 0x21B79D: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1596863==    by 0x21432E: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==1596863==    by 0x1F032C: testing::Test::Run() (gtest.cc:2517)
==1596863==    by 0x1F0D96: testing::TestInfo::Run() (gtest.cc:2703)
==1596863==    by 0x1F1487: testing::TestCase::Run() (gtest.cc:2825)
==1596863== 
==1596863== 144 bytes in 1 blocks are possibly lost in loss record 320 of 500
==1596863==    at 0x483D7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x50B1F46: __default_allocate (allocator.c:37)
==1596863==    by 0x5076C98: rcl_init_options_init (init_options.c:51)
==1596863==    by 0x50770A4: rcl_init_options_copy (init_options.c:84)
==1596863==    by 0x507603F: rcl_init (init.c:99)
==1596863==    by 0x4D99128: rclcpp::Context::init(int, char const* const*, rclcpp::InitOptions const&) (context.cpp:204)
==1596863==    by 0x4F1AB61: rclcpp::init(int, char const* const*, rclcpp::InitOptions const&) (utilities.cpp:34)
==1596863==    by 0x1A7E69: TestCreateSubscription::SetUp() (test_create_subscription.cpp:32)
==1596863==    by 0x21B79D: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1596863==    by 0x21432E: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==1596863==    by 0x1F032C: testing::Test::Run() (gtest.cc:2517)
==1596863==    by 0x1F0D96: testing::TestInfo::Run() (gtest.cc:2703)
==1596863== 
==1596863== 200 bytes in 1 blocks are possibly lost in loss record 353 of 500
==1596863==    at 0x483FD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x50B201F: __default_zero_allocate (allocator.c:62)
==1596863==    by 0x5075EB0: rcl_init (init.c:88)
==1596863==    by 0x4D99128: rclcpp::Context::init(int, char const* const*, rclcpp::InitOptions const&) (context.cpp:204)
==1596863==    by 0x4F1AB61: rclcpp::init(int, char const* const*, rclcpp::InitOptions const&) (utilities.cpp:34)
==1596863==    by 0x1A7E69: TestCreateSubscription::SetUp() (test_create_subscription.cpp:32)
==1596863==    by 0x21B79D: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1596863==    by 0x21432E: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==1596863==    by 0x1F032C: testing::Test::Run() (gtest.cc:2517)
==1596863==    by 0x1F0D96: testing::TestInfo::Run() (gtest.cc:2703)
==1596863==    by 0x1F1487: testing::TestCase::Run() (gtest.cc:2825)
==1596863==    by 0x1FCB70: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==1596863== 
==1596863== 336 bytes in 1 blocks are possibly lost in loss record 391 of 500
==1596863==    at 0x483FD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x40149CA: allocate_dtv (dl-tls.c:286)
==1596863==    by 0x40149CA: _dl_allocate_tls (dl-tls.c:532)
==1596863==    by 0x530E322: allocate_stack (allocatestack.c:622)
==1596863==    by 0x530E322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==1596863==    by 0x51DEF78: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==1596863==    by 0x67DA28A: std::thread::thread<void (eprosima::fastrtps::rtps::ResourceEvent::*)(), eprosima::fastrtps::rtps::ResourceEvent*, void>(void (eprosima::fastrtps::rtps::ResourceEvent::*&&)(), eprosima::fastrtps::rtps::ResourceEvent*&&) (thread:130)
==1596863==    by 0x67D8C2E: eprosima::fastrtps::rtps::ResourceEvent::init_thread() (ResourceEvent.cpp:262)
==1596863==    by 0x687BA82: eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) (RTPSParticipantImpl.cpp:199)
==1596863==    by 0x687C4C2: eprosima::fastrtps::rtps::RTPSParticipantImpl::RTPSParticipantImpl(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::GuidPrefix_t const&, eprosima::fastrtps::rtps::RTPSParticipant*, eprosima::fastrtps::rtps::RTPSParticipantListener*) (RTPSParticipantImpl.cpp:365)
==1596863==    by 0x688CB9B: eprosima::fastrtps::rtps::RTPSDomain::createParticipant(unsigned int, bool, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) (RTPSDomain.cpp:193)
==1596863==    by 0x688C53F: eprosima::fastrtps::rtps::RTPSDomain::createParticipant(unsigned int, eprosima::fastrtps::rtps::RTPSParticipantAttributes const&, eprosima::fastrtps::rtps::RTPSParticipantListener*) (RTPSDomain.cpp:111)
==1596863==    by 0x68937EF: eprosima::fastrtps::Domain::createParticipant(eprosima::fastrtps::ParticipantAttributes const&, eprosima::fastrtps::ParticipantListener*) (Domain.cpp:183)
==1596863==    by 0x5F3EF74: __create_participant(char const*, eprosima::fastrtps::ParticipantAttributes, bool, rmw_dds_common::Context*) (participant.cpp:112)
==1596863== 
==1596863== 336 bytes in 1 blocks are possibly lost in loss record 392 of 500
==1596863==    at 0x483FD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x40149CA: allocate_dtv (dl-tls.c:286)
==1596863==    by 0x40149CA: _dl_allocate_tls (dl-tls.c:532)
==1596863==    by 0x530E322: allocate_stack (allocatestack.c:622)
==1596863==    by 0x530E322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==1596863==    by 0x51DEF78: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==1596863==    by 0x5F3CB0A: std::thread::thread<void (&)(rmw_context_t*), rmw_context_t*&, void>(void (&)(rmw_context_t*), rmw_context_t*&) (thread:130)
==1596863==    by 0x5F3BFD5: rmw_fastrtps_shared_cpp::run_listener_thread(rmw_context_t*) (listener_thread.cpp:53)
==1596863==    by 0x5E73950: init_context_impl(rmw_context_t*) (init_rmw_context_impl.cpp:170)
==1596863==    by 0x5E73C6F: rmw_fastrtps_cpp::increment_context_impl_ref_count(rmw_context_t*) (init_rmw_context_impl.cpp:195)
==1596863==    by 0x5E8DF01: rmw_create_node (rmw_node.cpp:60)
==1596863==    by 0x553E31E: rmw_create_node (functions.cpp:188)
==1596863==    by 0x507C3A3: rcl_node_init (node.c:257)
==1596863==    by 0x4E0B38A: rclcpp::node_interfaces::NodeBase::NodeBase(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&, std::shared_ptr<rclcpp::Context>, rcl_node_options_t const&, bool, bool) (node_base.cpp:76)
==1596863== 
==1596863== 336 bytes in 1 blocks are possibly lost in loss record 393 of 500
==1596863==    at 0x483FD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x40149CA: allocate_dtv (dl-tls.c:286)
==1596863==    by 0x40149CA: _dl_allocate_tls (dl-tls.c:532)
==1596863==    by 0x530E322: allocate_stack (allocatestack.c:622)
==1596863==    by 0x530E322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==1596863==    by 0x51DEF78: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==1596863==    by 0x67E2762: std::thread::thread<void (eprosima::fastrtps::rtps::AsyncWriterThread::*)(), eprosima::fastrtps::rtps::AsyncWriterThread*, void>(void (eprosima::fastrtps::rtps::AsyncWriterThread::*&&)(), eprosima::fastrtps::rtps::AsyncWriterThread*&&) (thread:130)
==1596863==    by 0x67E05D2: eprosima::fastrtps::rtps::AsyncWriterThread::wake_up(eprosima::fastrtps::rtps::RTPSWriter*, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&) (AsyncWriterThread.cpp:100)
==1596863==    by 0x67FAF3D: eprosima::fastrtps::rtps::StatefulWriter::unsent_change_added_to_history(eprosima::fastrtps::rtps::CacheChange_t*, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&) (StatefulWriter.cpp:391)
==1596863==    by 0x68329BF: eprosima::fastrtps::rtps::WriterHistory::add_change_(eprosima::fastrtps::rtps::CacheChange_t*, eprosima::fastrtps::rtps::WriteParams&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >) (WriterHistory.cpp:104)
==1596863==    by 0x68BA638: eprosima::fastrtps::PublisherHistory::add_pub_change(eprosima::fastrtps::rtps::CacheChange_t*, eprosima::fastrtps::rtps::WriteParams&, std::unique_lock<std::recursive_timed_mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&) (PublisherHistory.cpp:114)
==1596863==    by 0x68B3124: eprosima::fastrtps::PublisherImpl::create_new_change_with_params(eprosima::fastrtps::rtps::ChangeKind_t, void*, eprosima::fastrtps::rtps::WriteParams&, eprosima::fastrtps::rtps::InstanceHandle_t const&) (PublisherImpl.cpp:215)
==1596863==    by 0x68B2AAA: eprosima::fastrtps::PublisherImpl::create_new_change_with_params(eprosima::fastrtps::rtps::ChangeKind_t, void*, eprosima::fastrtps::rtps::WriteParams&) (PublisherImpl.cpp:127)
==1596863==    by 0x68B29E4: eprosima::fastrtps::PublisherImpl::create_new_change(eprosima::fastrtps::rtps::ChangeKind_t, void*) (PublisherImpl.cpp:109)
==1596863== 
==1596863== 1,008 bytes in 3 blocks are possibly lost in loss record 433 of 500
==1596863==    at 0x483FD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x40149CA: allocate_dtv (dl-tls.c:286)
==1596863==    by 0x40149CA: _dl_allocate_tls (dl-tls.c:532)
==1596863==    by 0x530E322: allocate_stack (allocatestack.c:622)
==1596863==    by 0x530E322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
==1596863==    by 0x51DEF78: std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==1596863==    by 0x6954987: std::thread::thread<void (eprosima::fastdds::rtps::UDPChannelResource::*)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*, eprosima::fastrtps::rtps::Locator_t const&, void>(void (eprosima::fastdds::rtps::UDPChannelResource::*&&)(eprosima::fastrtps::rtps::Locator_t), eprosima::fastdds::rtps::UDPChannelResource*&&, eprosima::fastrtps::rtps::Locator_t const&) (thread:130)
==1596863==    by 0x69515C3: eprosima::fastdds::rtps::UDPChannelResource::UDPChannelResource(eprosima::fastdds::rtps::UDPTransportInterface*, asio::basic_datagram_socket<asio::ip::udp>&, unsigned int, eprosima::fastrtps::rtps::Locator_t const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, eprosima::fastdds::rtps::TransportReceiverInterface*) (UDPChannelResource.cpp:42)
==1596863==    by 0x69A871E: eprosima::fastdds::rtps::UDPTransportInterface::CreateInputChannelResource(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, eprosima::fastrtps::rtps::Locator_t const&, bool, unsigned int, eprosima::fastdds::rtps::TransportReceiverInterface*) (UDPTransportInterface.cpp:229)
==1596863==    by 0x69A8504: eprosima::fastdds::rtps::UDPTransportInterface::OpenAndBindInputSockets(eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastdds::rtps::TransportReceiverInterface*, bool, unsigned int) (UDPTransportInterface.cpp:203)
==1596863==    by 0x697AAB8: eprosima::fastdds::rtps::UDPv4Transport::OpenInputChannel(eprosima::fastrtps::rtps::Locator_t const&, eprosima::fastdds::rtps::TransportReceiverInterface*, unsigned int) (UDPv4Transport.cpp:302)
==1596863==    by 0x6877B4B: eprosima::fastrtps::rtps::ReceiverResource::ReceiverResource(eprosima::fastdds::rtps::TransportInterface&, eprosima::fastrtps::rtps::Locator_t const&, unsigned int) (ReceiverResource.cpp:41)
==1596863==    by 0x6871E6F: eprosima::fastrtps::rtps::NetworkFactory::BuildReceiverResources(eprosima::fastrtps::rtps::Locator_t&, std::vector<std::shared_ptr<eprosima::fastrtps::rtps::ReceiverResource>, std::allocator<std::shared_ptr<eprosima::fastrtps::rtps::ReceiverResource> > >&, unsigned int) (NetworkFactory.cpp:70)
==1596863==    by 0x687F32A: eprosima::fastrtps::rtps::RTPSParticipantImpl::createReceiverResources(eprosima::fastrtps::rtps::LocatorList_t&, bool, bool) (RTPSParticipantImpl.cpp:1020)
==1596863== 
==1596863== 35,209 (176 direct, 35,033 indirect) bytes in 1 blocks are definitely lost in loss record 494 of 500
==1596863==    at 0x483DE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1596863==    by 0x1B9EF5: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:114)
==1596863==    by 0x1B7D46: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:444)
==1596863==    by 0x1B59AD: std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, (__gnu_cxx::_Lock_policy)2> >&) (allocated_ptr.h:97)
==1596863==    by 0x1B33EB: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, char const*, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&>(rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >*&, std::_Sp_alloc_shared_tag<std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > >, char const*&&, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&) (shared_ptr_base.h:677)
==1596863==    by 0x1B16E5: std::__shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, char const*, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > >, char const*&&, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&) (shared_ptr_base.h:1344)
==1596863==    by 0x1AF7EA: std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >::shared_ptr<std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, char const*, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&>(std::_Sp_alloc_shared_tag<std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > >, char const*&&, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&) (shared_ptr.h:359)
==1596863==    by 0x1AD3D2: std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > std::allocate_shared<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > >, char const*, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&>(std::allocator<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > const&, char const*&&, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&) (shared_ptr.h:702)
==1596863==    by 0x1AB1C5: std::shared_ptr<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > > > std::make_shared<rclcpp::topic_statistics::SubscriptionTopicStatistics<test_msgs::msg::Empty_<std::allocator<void> > >, char const*, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&>(char const*&&, std::shared_ptr<rclcpp::Publisher<statistics_msgs::msg::MetricsMessage_<std::allocator<void> >, std::allocator<void> > >&) (shared_ptr.h:718)
==1596863==    by 0x1A1C69: std::shared_ptr<rclcpp::Subscription<test_msgs::msg::Empty_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<test_msgs::msg::Empty_<std::allocator<void> >, std::allocator<void> > > > rclcpp::create_subscription<test_msgs::msg::Empty_<std::allocator<void> >, TestCreateSubscription_create_with_statistics_Test::TestBody()::{lambda(std::shared_ptr<test_msgs::msg::Empty_<std::allocator<void> > >)#1}&, std::allocator<void>, test_msgs::msg::Empty_<std::allocator<void> >, rclcpp::Subscription<test_msgs::msg::Empty_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<test_msgs::msg::Empty_<std::allocator<void> >, std::allocator<void> > >, rclcpp::message_memory_strategy::MessageMemoryStrategy, std::shared_ptr<rclcpp::Node>&>(std::shared_ptr<rclcpp::Node>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&, TestCreateSubscription_create_with_statistics_Test::TestBody()::{lambda(std::shared_ptr<test_msgs::msg::Empty_<std::allocator<void> > >)#1}&, rclcpp::SubscriptionOptionsWithAllocator<std::allocator<void> > const&, rclcpp::message_memory_strategy::MessageMemoryStrategy::SharedPtr) (create_subscription.hpp:116)
==1596863==    by 0x1A0CE1: TestCreateSubscription_create_with_statistics_Test::TestBody() (test_create_subscription.cpp:63)
==1596863==    by 0x21B79D: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1596863== 
==1596863== LEAK SUMMARY:
==1596863==    definitely lost: 176 bytes in 1 blocks
==1596863==    indirectly lost: 35,033 bytes in 36 blocks
==1596863==      possibly lost: 2,460 bytes in 12 blocks
==1596863==    still reachable: 1,519,221 bytes in 1,045 blocks
==1596863==                       of which reachable via heuristic:
==1596863==                         multipleinheritance: 160 bytes in 1 blocks
==1596863==         suppressed: 0 bytes in 0 blocks
==1596863== Reachable blocks (those to which a pointer was found) are not shown.


Additional information

shared_ptr dependency chain:

sub_call_back -> subscription_topic_stats
timer -> sub_call_back
subscription_topic_stats -> timer

so, subscription_topic_stats -> subscription_topic_stats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant