Monday, June 23, 2014

VTK python object garbage collection

VTK use smart pointer to handle objects in c++. It is garbage collection in python. All the objects will be unavailable out of scope unless you keep ref count on them.

I return those objects in functions. So far, it works for me.

All the regular objects in vtk module work. But I also use vtk.util.numpy_support for the conversion between numpy data and vtk data. I have to use deep = True to make a deep copy. Otherwise, numpy arrays are garbage collected out of the scope.

No comments:

Post a Comment