[vtkusers] Memory leaks using vtk filters
Hans Gruendel
hans.gruendel at web.de
Tue Feb 9 10:01:34 EST 2010
Hello All,
after using vtk quite often in complex projects I run into trouble with
memory leaks. Thus my question is:
How to reuse data produced by vtkAlgorithms after having deleted the
producing algorithm?
Is the following procedure right?
vtkPolyData * UtilsClass::cutIsoValue(vtkUnstructuredGrid Block, double
IsoValue)
{
vtkContourFilter * cF = vtkContourFilter::New();
cF->SetInputConnection(Block->GetProducerPort());
cF->SetValue(0,IsoValue);
cF->Update();
vtkPolyData * PolyData = vtkPolyData::New();
PolyData->ShallowCopy( cF->GetOutput() );
cF->Delete();
return PolyData;
}
and the calling function
{
vtkPolyData* ResultPolyData = UtilsClass::cutIsoValue(Block, Isovalue);
..and later..
ResultPolyData->Delete();
}
I suspect memory leaks using this procedure.
- What is happening with the cF->GetOutput()? Is all the working data of
cF really deleted?
- Is everything properly deleted at the end of the calling function?
- What would be the proper manner?
- Could a method from the vtkobject class solve the problem?
Thanks for your help in advance.
Greetings Hans
More information about the vtkusers
mailing list