-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Describe the bug
Context ros2/rcl#1198 and Yaskawa-Global/motoros2#35
I believe that there is a possible memory leak in rmw_microxrcedds. In the micro-ROS rcl repo, the following lines duplicate a string and dynamically allocate the memory if RCL_MICROROS_COMPLETE_IMPL is set.
This memory which is dynamically allocated for enclave via rcutils_strdup is deallocated in other (full) rmw implementations. For example:
However it is never deallocated in rmw_microxrcedds. I believe that this is only a problem if RCL_MICROROS_COMPLETE_IMPL is set, because that is the only case where rcutils_strdup runs and sets aside dynamic memory.
I do not believe that the solution is as simple as freeing the memory in rmw_init_options_fini, because the code below copies the enclave data to static memory, and thus cannot be freed. I might be wrong about that.
To Reproduce
I do not have a MWE, but it is apparent in MotoROS2 using the debug listener script. edit - I have a MWE below
Expected behaviour
I expect the memory set aside by rcutils_strdup to be freed by the rmw, as it is with other rmws.
System information (please complete the following information):
- YRC1000
- ROS 2: I am currently using Jazzy. I believe that the problem exists on Humble as well, though.
- Version: I am currently using a fork off of 2.4.3
Please let me know if I need to provide any more information, or if I am doing something improperly. Thank you.