[vtkusers] Re: ReleaseDataFlagOn in VTK 5.0

Goodwin Lawlor goodwin.lawlor at ucd.ie
Thu Mar 16 08:48:04 EST 2006


Stefanie Nowak wrote:
> Hallo,
> 
> we recently updated our program from VTK 4.4 to VTK 5.0 and have some 
> problems with the new pipeline mechanism.
> In class vtkAlgorithm it is described that the methods 
> ReleaseDataFlagOn() and ReleaseDataFlagOff() belong to the old pipeline.
> How is it possible to release memory in the new pipeline?
> 
> Thanks a lot for help,
> Stefanie

Hi Stefanie,

I can't find where in the (5.0) documentation is says that 
ReleaseDataFlagOn() belongs to the old pipeline. It just says that 
vtkAlgorithm::ReleaseDataFlagOn is now a convenience routine. It is 
equivalent to:

vtkAlgorithm::GetExective()->GetOutputInformation(port)->Set(RELEASE_DATA(), 
1)

for each of the filter's output ports.

vtkAlgorithm::GetExective()->SetReleaseDataFlag(port, 1)

does the same thing.

Looking at the source code (vtkDemandDrivenPipeline::ExecuteDataEnd) it 
looks like the input port information is checked for the RELEASE_DATA() 
flag (not the output port info which the above methods set) when 
deciding whether or not to release data (the GlobalReleaseDataFlag is 
checked too).

So you could try:

vtkDemandDrivenPipeline* ddp =
      vtkDemandDrivenPipeline::SafeDownCast(filter->GetExecutive());
ddp->GetInputInformation(port)->Set(RELEASE_DATA(),1);

or

filter->GetOutput()->SetGlobalReleaseDataFlag(1);


It seems that info gets copied between output and input ports when they 
are connected... but only when the 
filter2->SetInputConnection(filter1->GetOutputPort()) methods are used. 
Are you still using the old filter2->SetInput(filter1->GetOutput())? 
This could be the problem...


hth

Goodwin





More information about the vtkusers mailing list