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 of mock test #799

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

Memory leak because of mock test #799

iuhilnehc-ynos opened this issue Sep 14, 2020 · 0 comments · Fixed by #800

Comments

@iuhilnehc-ynos
Copy link
Collaborator

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • Installation type:
    • source
  • Version or commit hash:
  • DDS implementation:
    • fastrtps
  • 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_init__rmw_fastrtps_cpp

Expected behavior

No memory leak

Actual behavior

memory leak via valgrind

==2206875== HEAP SUMMARY:
==2206875==     in use at exit: 664 bytes in 8 blocks
==2206875==   total heap usage: 2,560 allocs, 2,552 frees, 1,171,314 bytes allocated
==2206875== 
==2206875== 144 bytes in 1 blocks are definitely lost in loss record 6 of 8
==2206875==    at 0x483F7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==2206875==    by 0x49A4F46: __default_allocate (allocator.c:37)
==2206875==    by 0x4867C98: rcl_init_options_init (init_options.c:51)
==2206875==    by 0x12FD4D: TestRCLFixture__rmw_fastrtps_cpp_test_mocked_rcl_init_options_fini_Test::TestBody() (test_init.cpp:542)
==2206875==    by 0x1755B9: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==2206875==    by 0x16DED2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==2206875==    by 0x149B21: testing::Test::Run() (gtest.cc:2522)
==2206875==    by 0x14A51A: testing::TestInfo::Run() (gtest.cc:2703)
==2206875==    by 0x14AC0B: testing::TestCase::Run() (gtest.cc:2825)
==2206875==    by 0x1562F4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==2206875==    by 0x176AB3: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2447)
==2206875==    by 0x16EFE6: bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2483)
==2206875== 
==2206875== 144 bytes in 1 blocks are definitely lost in loss record 7 of 8
==2206875==    at 0x483F7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==2206875==    by 0x49A4F46: __default_allocate (allocator.c:37)
==2206875==    by 0x4867C98: rcl_init_options_init (init_options.c:51)
==2206875==    by 0x48680A4: rcl_init_options_copy (init_options.c:84)
==2206875==    by 0x1307B9: TestRCLFixture__rmw_fastrtps_cpp_test_rcl_init_copy_mocked_fail_fini_Test::TestBody() (test_init.cpp:560)
==2206875==    by 0x1755B9: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==2206875==    by 0x16DED2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==2206875==    by 0x149B21: testing::Test::Run() (gtest.cc:2522)
==2206875==    by 0x14A51A: testing::TestInfo::Run() (gtest.cc:2703)
==2206875==    by 0x14AC0B: testing::TestCase::Run() (gtest.cc:2825)
==2206875==    by 0x1562F4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==2206875==    by 0x176AB3: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2447)
==2206875== 
==2206875== 144 bytes in 1 blocks are definitely lost in loss record 8 of 8
==2206875==    at 0x483F7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==2206875==    by 0x49A4F46: __default_allocate (allocator.c:37)
==2206875==    by 0x4867C98: rcl_init_options_init (init_options.c:51)
==2206875==    by 0x48680A4: rcl_init_options_copy (init_options.c:84)
==2206875==    by 0x13114E: TestRCLFixture__rmw_fastrtps_cpp_test_rcl_init_options_copy_fail_rmw_copy_Test::TestBody() (test_init.cpp:585)
==2206875==    by 0x1755B9: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2447)
==2206875==    by 0x16DED2: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2483)
==2206875==    by 0x149B21: testing::Test::Run() (gtest.cc:2522)
==2206875==    by 0x14A51A: testing::TestInfo::Run() (gtest.cc:2703)
==2206875==    by 0x14AC0B: testing::TestCase::Run() (gtest.cc:2825)
==2206875==    by 0x1562F4: testing::internal::UnitTestImpl::RunAllTests() (gtest.cc:5216)
==2206875==    by 0x176AB3: bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (gtest.cc:2447)
==2206875== 
==2206875== LEAK SUMMARY:
==2206875==    definitely lost: 432 bytes in 3 blocks
==2206875==    indirectly lost: 0 bytes in 0 blocks
==2206875==      possibly lost: 0 bytes in 0 blocks
==2206875==    still reachable: 232 bytes in 5 blocks
==2206875==         suppressed: 0 bytes in 0 blocks
==2206875== Reachable blocks (those to which a pointer was found) are not shown.
==2206875== To see them, rerun with: --leak-check=full --show-leak-kinds=all

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