Skip to content

Not finalize guard condition while destructing SubscriptionIntraProcess #1306

@Barry-Xu-2018

Description

@Barry-Xu-2018

Bug report

  • 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 --packages-up-to rclcpp --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Debug
$ source install/setup.bash
$ valgrind --leak-check=full ./build/rclcpp/test/test_subscription

Expected behavior

No memory leak

Actual behavior

Memory leak occur

==190768== 
==190768== HEAP SUMMARY:
==190768==     in use at exit: 46,900 bytes in 100 blocks
==190768==   total heap usage: 10,538 allocs, 10,438 frees, 4,416,678 bytes allocated
==190768== 
==190768== 144 (56 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 24 of 34
==190768==    at 0x483F7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==190768==    by 0x50FBF46: __default_allocate (allocator.c:37)
==190768==    by 0x508B690: __rcl_guard_condition_init_from_rmw_impl (guard_condition.c:73)
==190768==    by 0x508B842: rcl_guard_condition_init (guard_condition.c:108)
==190768==    by 0x4F20E4E: rclcpp::experimental::SubscriptionIntraProcess<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, std::default_delete<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >, rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >::SubscriptionIntraProcess(rclcpp::AnySubscriptionCallback<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void> >, std::shared_ptr<std::allocator<void> >, std::shared_ptr<rclcpp::Context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rmw_qos_profile_t, rclcpp::IntraProcessBufferType) (subscription_intra_process.hpp:86)
==190768==    by 0x4F1F8A3: void __gnu_cxx::new_allocator<rclcpp::experimental::SubscriptionIntraProcess<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, std::default_delete<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >, rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > > >::construct<rclcpp::experimental::SubscriptionIntraProcess<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, std::default_delete<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >, rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >, rclcpp::AnySubscriptionCallback<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void> >&, std::shared_ptr<std::allocator<void> >, std::shared_ptr<rclcpp::Context>&, char const*, rmw_qos_profile_t&, rclcpp::IntraProcessBufferType>(rclcpp::experimental::SubscriptionIntraProcess<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void>, std::default_delete<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >, rcl_interfaces::msg::ParameterEvent_<std::allocator<void> > >*, rclcpp::AnySubscriptionCallback<rcl_interfaces::msg::ParameterEvent_<std::allocator<void> >, std::allocator<void> >&, std::shared_ptr<std::allocator<void> >&&, std::shared_ptr<rclcpp::Context>&, char const*&&, rmw_qos_profile_t&, rclcpp::IntraProcessBufferType&&) (new_allocator.h:147)
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions