[vtkusers] cleaning the memory used by a filter

Brad King brad.king at kitware.com
Tue Nov 16 13:24:25 EST 2004


Bruno wrote:
> How can I clean the memory used by a filter whose release data flag is 
> OFF?. For example (observe the comments):
> 
> 
>     vtkImageThreshold *selectIsoValue = vtkImageThreshold::New();
>     selectIsoValue->SetInput(InputData);
>    ...... other processing
> 
>     selectIsoValue->ReleaseDataFlagOff(); // I don't want to turn it on
>     selectIsoValue->Update();
> 
>    ...... other processing
> 
>     selectIsoValue->Delete(); // I thought that this command would clean 
> the memory, but it doesn't.

If you are using VTK from CVS then the input is still holding a 
reference and the connection.  You have to disconnect the filter and 
then delete it:

selectIsoValue->SetInput(0);
selectIsoValue->Delete();

-Brad



More information about the vtkusers mailing list