Xamla / torch-pcl

Point Cloud Library (PCL) bindings for Torch
BSD 3-Clause "New" or "Revised" License
30 stars 7 forks source link

Memory leak #11

Open mys007 opened 7 years ago

mys007 commented 7 years ago

I have observed a memory leak in Indices filled by KdTree.radiusSearch() or KdTree.nearestKSearch() and read by Indices.viewAsTensor() afterwards. Calling an explicit storage():free() on the obtained tensor's storage then seems necessary.

andreaskoepf commented 7 years ago

Hi @mys007! Thanks for reporting the issue. Do you have a little code snippet that reproduces the leak? Calling storage():free() on the Tensor returned by Indices.viewAsTensor() should normally not be necessary because the Tensor is just a view into internal vector memory, no real copy of the data (see indices.cpp). Have you checked that a no longer referenced object will not be freed by a collectgarbage() call?