[vtkusers] vtkImageReslice memory leak problem
David Gobbi
david.gobbi at gmail.com
Thu Mar 22 02:09:25 EDT 2012
Which version of VTK are you using? And which OS?
I you are on Linux or OS X, you should be able to use
valgrind to identify the line of code where the leaked
memory was allocated.
- David
On Wed, Mar 21, 2012 at 10:02 PM, ysa0829 <ysa0829 at gmail.com> wrote:
> 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.
More information about the vtkusers
mailing list