[vtkusers] ReleaseDataFlag

Tim Hutton T.Hutton at eastman.ucl.ac.uk
Fri Mar 22 08:31:01 EST 2002


Hello VTK people,

I'm confused about the ReleaseDataFlag. A couple of my own filters were 
using a lot of memory, so I called 
vtkDataObject::SetGlobalReleaseDataFlag(1) to try to release memory from 
earlier in the pipeline that was no longer needed. This works spectacularly 
for one of them, everything was fine. For the other, however, I got 
problems because towards the end of the Execute() function the data in 
this->GetInput() had been released and had gone! I think the problem is 
captured in this sketch:

void MyFilter::Execute()
{
   ...

   this->GetInput()->GetCell(id); // fine, since data not released

   ...

   vtkTransformPolyDataFilter trans
      trans->SetInput(this->GetInput());
      ...
      trans->Update();

   ... // use output of trans

   this->GetInput()->GetCell(id); // ERROR! data has been released!

}

When trans has finished, it checks to see if it can release its data. The 
global flag says yes, so it releases this->GetInput() which is disastrous.

How do I stop the data being released mid-Execute? Using 
ReleaseDataFlagOff() calls doesn't work because the global flag overrides 
them! (see vtkDataObject::ShouldIReleaseData)

I'm using the latest CVS of VTK4 on win2k with visualc++6.

Thanks,

Tim.
---------------------------------------------------------------------------
Tim Hutton,                        http://www.eastman.ucl.ac.uk/~dmi/MINORI
Research Fellow & PhD student,                   T.Hutton at eastman.ucl.ac.uk
MINORI Project, Biomedical Informatics Unit,     Tel: [+44] (0)20 7915 2344
Eastman Dental Institute, UCL,                   Fax: [+44] (0)20 7915 2303
256 Gray's Inn Road, London WC1X 8LD, UK      Mobile: [+44] (0)7748 678 832
---------------------------------------------------------------------------
This email represents the views of the sender alone and must not be 
construed as representing the views of the Eastman Dental Institute. It may 
contain confidential information and may be protected by law as a legally 
privileged document and copyright work. Its content should not be disclosed 
and it should not be given or copied to anyone other than the person(s) 
named or referenced above. If you have received this email in error, please 
contact the sender.




More information about the vtkusers mailing list