[vtkusers] when is ok to Delete()

Burlen burlen at apollo.sr.unh.edu
Fri Feb 10 09:58:53 EST 2006


Hi, I have the following code on the inside of 3 nested loops. After all the 
loops are finished I then get the output of the append filter. I seem to be 
running out of memory before the loops complete. My question is: can I 
Delete() vtkExtractGeometry, and vtkPlanes objects  before I GetOutput of the 
vtkAppendFilter? or do I have to keep all these around till after GetOutput() 
is called?


vtkAppendFilter *af = ...;

for (...)
for (...)
for (...)

if ( ( ints = this->BoxIntersect(coarseBox, fineBox) ) != NULL )
{// intersection is not empty
           
  vtkPlanes           *removeThis    = vtkPlanes::New();
  vtkExtractGeometry  *removalFilter = vtkExtractGeometry::New();
            
  //
  // remove the overlap region from coarse data
  //
  removeThis->SetBounds(ints);
  removalFilter->ExtractBoundaryCellsOff();
  removalFilter->ExtractInsideOff();
  removalFilter->SetImplicitFunction(removeThis);
  removalFilter->SetInput(coarseBox);
            
  af->AddInput( removalFilter->GetOutput() );
  af->Update();
  
  //
  // should I Delete() removeThis and removalFilter here??
  // 
}

endfor(...)
endfor(...)
endfor(...)

return af->GetOutput();

-- 

Burlen Loring
Space Science Center
Institute for the Study of Earth, Oceans, and Space
University of New Hampshire
39 College Road, Durham, NH 03824
Phone: 603-862-1140



More information about the vtkusers mailing list