-
Notifications
You must be signed in to change notification settings - Fork 466
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 when displaying DepthCloud and showing the 'Add' menu #868
Comments
It's likely that the depth display is queueing messages. If it has a queue size option in the UI, you should decrease it and confirm that that fixes your problem. If it doesn't have a queue size option, that's a bug, and one should be added. |
I just checked the DepthCloud plugin and confirmed that it has a |
Sorry for the late reply. Set it to 1. Same issue. |
Ok, thanks @trainman419 and @cdondrup for looking into this. I'll try to reproduce it in the near future, maybe next week. |
I managed to reproduce the issue on Ubuntu 14.04 and rviz (indigo_devel, 11fcdad). Below you can find a workaround that works for me. diff --git a/src/rviz/default_plugin/point_cloud_common.cpp b/src/rviz/default_plugin/point_cloud_common.cpp
index 4549d86..fc6c0e2 100644
--- a/src/rviz/default_plugin/point_cloud_common.cpp
+++ b/src/rviz/default_plugin/point_cloud_common.cpp
@@ -309,6 +309,7 @@ void PointCloudCommon::CloudInfo::clear()
PointCloudCommon::PointCloudCommon( Display* display )
: spinner_(1, &cbqueue_)
+, queue_size(5)
, new_xyz_transformer_(false)
, new_color_transformer_(false)
, needs_retransform_(false)
@@ -724,7 +725,13 @@ void PointCloudCommon::processMessage(const sensor_msgs::PointCloud2ConstPtr& cl
if (transformCloud(info, true))
{
boost::mutex::scoped_lock lock(new_clouds_mutex_);
+
+ // The vector is full, remove the oldest element.
+ if (new_cloud_infos_.size() >= this->queue_size)
+ new_cloud_infos_.erase(new_cloud_infos_.begin());
+
new_cloud_infos_.push_back(info);
+
display_->emitTimeSignal( cloud->header.stamp );
}
}
diff --git a/src/rviz/default_plugin/point_cloud_common.h b/src/rviz/default_plugin/point_cloud_common.h
index 20d47d6..0bdd7e9 100644
--- a/src/rviz/default_plugin/point_cloud_common.h
+++ b/src/rviz/default_plugin/point_cloud_common.h
@@ -188,6 +188,7 @@ private:
Ogre::SceneNode* scene_node_;
V_CloudInfo new_cloud_infos_;
+ size_t queue_size;
boost::mutex new_clouds_mutex_;
L_CloudInfo obsolete_cloud_infos_;
@@ -209,6 +210,7 @@ private:
bool new_color_transformer_;
bool needs_retransform_;
+
pluginlib::ClassLoader<PointCloudTransformer>* transformer_class_loader_;
Display* display_;
|
@caguero thank you for taking that up! |
We experience a similar issue when playing back a |
We also experienced a similar issue displaying PointCloud2. The work around did not seem to help. |
We experienced a severe memory leak in rviz today.
Here is the problem, we are displaying a
DepthCloud
using a depth and color image, from a rosbag at normal speed. As soon as I press the 'Add' button to add another visualisation the GUI stops updating and the memory usage increase rapidly, i.e. ~500MB per second. This is the reason for our laptop with very little memory, to freeze immediately. If theDepthCloud
is turned off, no such behaviour can be observed.This only happens with the
DepthCloud
as far as we can say. Not sure about point clouds.We are running 14.04 64bit and ROS Indigo. rviz: version 1.11.7 (indigo) compiled against OGRE version 1.8.1 (Byatis).
The text was updated successfully, but these errors were encountered: