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

Cdds[Client/Service] created in rmw_create_[client/service] not destroyed after rmw_destroy_[client/service] #235

Closed
iuhilnehc-ynos opened this issue Sep 4, 2020 · 1 comment · Fixed by #236

Comments

@iuhilnehc-ynos
Copy link

Bug report

Required Info:

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

Steps to reproduce issue

$ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug --packages-up-to rcl
$ . install/setup.bash
$ valgrind --leak-check=full ./build/rcl/test/test_client__rmw_cyclonedds_cpp

Expected behavior

No memory leak

Actual behavior

memory leak via valgrind

==252190== 136 (32 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 12 of 26
==252190==    at 0x483DE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==252190==    by 0x51819DC: rmw_create_client (rmw_node.cpp:3873)
==252190==    by 0x4860929: rcl_client_init (client.c:169)
==252190==    by 0x17819C: TestClientFixture_test_client_nominal_Test::TestBody() (test_client.cpp:84)
==252190==    by 0x1B5D43: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==252190==    by 0x1AE596: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==252190==    by 0x189B3F: testing::Test::Run() (gtest.cc:2522)
==252190==    by 0x18A538: testing::TestInfo::Run() (gtest.cc:2703)
==252190==    by 0x18AC29: testing::TestCase::Run() (gtest.cc:2825)
==252190==    by 0x196312: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==252190==    by 0x1B723D: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2447)
==252190==    by 0x1AF6AA: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2483)
==252190== 
==252190== 136 (32 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 26
==252190==    at 0x483DE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==252190==    by 0x51819DC: rmw_create_client (rmw_node.cpp:3873)
==252190==    by 0x4860929: rcl_client_init (client.c:169)
==252190==    by 0x17930D: TestClientFixture_test_client_init_fini_Test::TestBody() (test_client.cpp:153)
==252190==    by 0x1B5D43: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==252190==    by 0x1AE596: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==252190==    by 0x189B3F: testing::Test::Run() (gtest.cc:2522)
==252190==    by 0x18A538: testing::TestInfo::Run() (gtest.cc:2703)
==252190==    by 0x18AC29: testing::TestCase::Run() (gtest.cc:2825)
==252190==    by 0x196312: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==252190==    by 0x1B723D: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2447)
==252190==    by 0x1AF6AA: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2483)

@iuhilnehc-ynos
Copy link
Author

After fixing Cdds[Client/Service], detect some other memory leak about CddsPublisher/CddsSubscription in rmw_init_cs,

auto pub = new CddsPublisher();
auto sub = new CddsSubscription();

continue to fix them.

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