ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

memory corruption

asked 2015-06-03 16:49:08 -0500

rnunziata gravatar image

updated 2015-06-03 16:49:41 -0500

get error in callback this is caused by the last line ... any ideas what is happening. I am using pcl 1.7.2 and ros indigo under ubuntu 14.04.

 void  cloud_cb (const sensor_msgs::PointCloud2ConstPtr& msg)
{
  pcl::PointCloud<pcl::PointXYZRGBA> cloudxx;
  pcl::fromROSMsg(*msg,cloudxx);  // Convert ros msg cloud to pcl cloud
  CloudConstPtr cloud(&cloudxx);  // this line generates error
}

*** Error in `/home/richard/catkin_ws/devel/lib/testPCD/testPCD': double free or corruption (out): 0x00007ffd908a8c50 ***
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-06-03 17:30:58 -0500

rnunziata gravatar image

OK...this code fixed the issue (there maybe other issues) but I do not know why....if someone can explain it would be helpful.

  pcl::PointCloud<pcl::PointXYZRGBA> cloudxx;
  pcl::fromROSMsg(*msg,cloudxx);  // Convert ros msg cloud to pcl cloud
  pcl::PointCloud<pcl::PointXYZRGBA>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGBA>(cloudxx));
  CloudConstPtr cloud(point_cloud_ptr);
edit flag offensive delete link more

Comments

hi, I have the same error msg. How do you use CloudConstPtr cloud () ? I got CloudConstPtr was not declared when i tried to use it

jhlim6 gravatar image jhlim6  ( 2016-02-11 01:32:13 -0500 )edit

Thanks, I just realized that line 3 is the critical line, not line 4. That solved my problem of double freeing pointers.

jhlim6 gravatar image jhlim6  ( 2016-02-11 01:53:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-06-03 16:49:08 -0500

Seen: 1,958 times

Last updated: Jun 03 '15