Ask Your Question

Revision history [back]

The pcl Ptrs are boost shared_ptrs and clean up after themselves (you should look this up elsewhere, http://docs.pointclouds.org/trunk/common_2include_2pcl_2point__cloud_8h_source.html shows some of this), but local_pca is raw allocated memory so you need to clean that up yourself after you finish using it (like the end of the callback) unless somewhere in the ... you are handing it to a constructor or something else that takes ownership of the memory.

This isn't really ros related except you happen to be in a callback and converting to pcl from a sensor_msg, the memory allocation is purely the domain of pcl and C++.

The pcl Ptrs are boost shared_ptrs and clean up after themselves (you should look this up elsewhere, http://docs.pointclouds.org/trunk/common_2include_2pcl_2point__cloud_8h_source.html shows some of this), line 428 for example), but local_pca is raw allocated memory so you need to clean that up yourself after you finish using it (like the end of the callback) unless somewhere in the ... you are handing it to a constructor or something else that takes ownership of the memory.

This isn't really ros related except you happen to be in a callback and converting to pcl from a sensor_msg, the memory allocation is purely the domain of pcl and C++.

The pcl Ptrs are boost shared_ptrs and clean up after themselves (you should look this up elsewhere, http://docs.pointclouds.org/trunk/common_2include_2pcl_2point__cloud_8h_source.html line 428 for example), but local_pca is raw allocated memory so you need to clean that up yourself after you finish using it (like the end of the callback) unless somewhere in the ... you are handing it to a constructor or something else that takes ownership of the memory.

This isn't really ros related except you happen to be in a callback and converting to pcl from a sensor_msg, the memory allocation is purely the domain of pcl and C++.pcl/boost/C++.