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

Extracted msg from LoanedMessage not destroy #1304

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

Extracted msg from LoanedMessage not destroy #1304

iuhilnehc-ynos opened this issue Sep 11, 2020 · 0 comments · Fixed by #1305
Assignees
Labels
bug Something isn't working

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_loaned_message

Expected behavior

No memory leak

Actual behavior

memory leak log

==1676834== 
==1676834== HEAP SUMMARY:
==1676834==     in use at exit: 52,173 bytes in 106 blocks
==1676834==   total heap usage: 20,136 allocs, 20,030 frees, 9,441,487 bytes allocated
==1676834== 
==1676834== 48 bytes in 1 blocks are definitely lost in loss record 1 of 31
==1676834==    at 0x483DE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1676834==    by 0x14DD6A: __gnu_cxx::new_allocator<test_msgs::msg::BasicTypes_<std::allocator<void> > >::allocate(unsigned long, void const*) (new_allocator.h:114)
==1676834==    by 0x14CFD5: rclcpp::LoanedMessage<test_msgs::msg::BasicTypes_<std::allocator<void> >, std::allocator<void> >::LoanedMessage(rclcpp::PublisherBase const&, std::allocator<test_msgs::msg::BasicTypes_<std::allocator<void> > >) (loaned_message.hpp:80)
==1676834==    by 0x14B90C: rclcpp::LoanedMessage<test_msgs::msg::BasicTypes_<std::allocator<void> >, std::allocator<void> >::LoanedMessage(rclcpp::PublisherBase const*, std::shared_ptr<std::allocator<test_msgs::msg::BasicTypes_<std::allocator<void> > > >) (loaned_message.hpp:109)
==1676834==    by 0x14BE61: rclcpp::Publisher<test_msgs::msg::BasicTypes_<std::allocator<void> >, std::allocator<void> >::borrow_loaned_message() (publisher.hpp:176)
==1676834==    by 0x148F76: TestLoanedMessage_release_Test::TestBody() (test_loaned_message.cpp:70)
==1676834==    by 0x19785B: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==1676834==    by 0x1903BA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==1676834==    by 0x16BECD: testing::Test::Run() (gtest.cc:2522)
==1676834==    by 0x16C8C6: testing::TestInfo::Run() (gtest.cc:2703)
==1676834==    by 0x16CFB7: testing::TestCase::Run() (gtest.cc:2825)
==1676834==    by 0x1786A0: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==1676834== 
==1676834== LEAK SUMMARY:
==1676834==    definitely lost: 48 bytes in 1 blocks
==1676834==    indirectly lost: 0 bytes in 0 blocks
==1676834==      possibly lost: 0 bytes in 0 blocks
==1676834==    still reachable: 52,125 bytes in 105 blocks
==1676834==         suppressed: 0 bytes in 0 blocks
==1676834== Reachable blocks (those to which a pointer was found) are not shown.
==1676834== To see them, rerun with: --leak-check=full --show-leak-kinds=all

@iuhilnehc-ynos iuhilnehc-ynos changed the title Extra msg from LoanedMessage not destroy Extracted msg from LoanedMessage not destroy Sep 14, 2020
@mabelzhang mabelzhang added the bug Something isn't working label Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants