[vtkusers] vtkImageReslice memory leak problem

ysa0829 ysa0829 at gmail.com
Thu Mar 22 00:02:30 EDT 2012


hi all,

I use vtkImageReslice class and find some memory leak problem .

I have memory leaks only that I call  reSlice->Update(), otherwise
everything is fine.

Here is my example code:



void ImageResliceTest(vtkImageData* imageData)
{
       vtkImageReslice *reSlice = vtkImageReslice::New();
      vtkMatrix4x4 *reSliceAxes = vtkMatrix4x4::New();
        
       reSlice ->SetInput(imageData ); 
       reSlice->SetResliceAxes(reSliceAxes);
       reSlice->SetInterpolationModeToCubic();
       reSlice->SetOutputSpacing(0.5, 0.5,0.5);
       reSlice->SetOutputOrigin(0.5, 0.5, 0);
       reSlice->SetOutputExtent(0, 50-1, 0, 50-1, 0, 0);
       reSlice->Update();

       reSliceAxes->Delete(); 
       reSlice->Delete();         
}

int main(int argc, char *argv[]) 
{
  vtkImageData *imageData = vtkImageData::New();

    for(int i = 0 ; i < 100 ; i++)
    {
       ImageResliceTest(imageData );
    }
  
 return 1; 
}

If I call the  reSlice->Update() , it still increases my memory , even after
I use reSliceAxes->Delete(); 
       reSlice->Delete(), memory increment is about 50~100K  eachtime I call
ImageResliceTest.

Is this a bug existing in vtkImageReslice class, or any suggestion to solve
the memory leak problem ?

Thanks in advance.





--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkImageReslice-memory-leak-problem-tp5584699p5584699.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list