[vtkusers] Memory leaks

Jose Navas josenavasmolina at hotmail.com
Thu Dec 1 03:18:29 EST 2011


Hi all,
I am developing a medical application which allows the user to generate several times the same polyData but changing some attributes like marching cubes' isovalue or to apply/not to apply some filter, such as vtkPolyDataConnectivityFilter. Here is a structure of my code:
class Model{    ...    vtkSmartPointer<vtkPolyData> mMesh;    ...}
void Model::generateMesh(double isovalue, bool connected){    mMesh = generateMarchingCubesMesh(isovalue, someVtkImageData)    if(connected) mMesh = getLargestConnectedMesh(mMesh)    // connect to rendering pipeline....}
Where:  - generateMarchingCubesMesh is a function that returns a vtkSmartPointer<vtkPolyData> and executes vtkMarchingCubes and vtkTriangleFilter  - getLargestConnectedMesh is a function that returns a vtkSmartPointer<vtkPolyData> and executes vtkPolyDataConnectivityFilter
When the user regenerates the mesh, the existing structures are not deleted and don't release memory, so what I have to do to release all these memory?
Another question is if there is any way to not to hold all the structures (vtkMarchingCubes, vtkTriangleFilter, etc...) used to propagate the update() call upstream, due to the user don't changes changes the vtkImageData source. In other words, how to delete all the structures once the resulting vtkPolyData is generated?
Thanks,
Jose 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111201/14a6db58/attachment.htm>


More information about the vtkusers mailing list