ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Yes, there is a memory leak in roscpp's base Transport class. You can see a full explanation in the pull request to fix the issue that is currently under review: https://github.com/ros/ros_comm/pull/570
The short version is that the Linux function getifaddrs() requires a freeifaddrs() call once the list of network interface structures are no longer needed. Since this issue is present inside roscpp's base class, Transport, every new connection loses a few Kb in memory. This means ROS Service servers then devour memory if left alive for long enough. Fortunately, the fix was a one-liner.
As for debugging ROS with Valgrind, if you attempt to run valgrind --tool=memcheck --leak-check=yes rosrun package_foo executable_bar
,
you will not get useful memory stats. I believe this is due to rosrun
spawning your node in a separate process. To get around this, you can call your executable directly:
(from the root of your catkin workspace) valgrind --tool=memcheck --leak-check=yes ./devel/lib/package_foo/executable_bar
Alternatively, you could write your own launchfile with Valgrind in the launch-prefix.
2 | No.2 Revision |
Yes, there is was a memory leak in roscpp's base Transport class. class for ROS Indigo. You can see a full explanation in the pull request to fix the issue that is currently under review: (which has now been merged): https://github.com/ros/ros_comm/pull/570
The short version is that the Linux function getifaddrs() requires a freeifaddrs() call once the list of network interface structures are no longer needed. Since this issue is present inside roscpp's base class, Transport, every new connection loses a few Kb in memory. This means ROS Service servers then devour memory if left alive for long enough. Fortunately, the fix was a one-liner.
As for debugging ROS with Valgrind, if you attempt to run valgrind --tool=memcheck --leak-check=yes rosrun package_foo executable_bar
,
you will not get useful memory stats. I believe this is due to rosrun
spawning your node in a separate process. To get around this, you can call your executable directly:
(from the root of your catkin workspace) valgrind --tool=memcheck --leak-check=yes ./devel/lib/package_foo/executable_bar
Alternatively, you could write your own launchfile with Valgrind in the launch-prefix.