[vtk-developers] Strange memory leaks with vtkImageReslice

David Gobbi dgobbi at atamai.com
Fri Apr 13 13:28:47 EDT 2007


Hi Mathieu,

I can't find any reason for the leak that you have discovered, but I was 
able to reproduce it.

For me, it went away if I changed your code so that "slicer" is deleted 
before "image".  You can try that as a temporary solution.

I'll have to dig into the code to see what the actual source of the leak 
is.  It is indeed a strange one.

 - David


Mathieu Coursolle wrote:
> Hi,
>
> I am currently using vtkImageReslice class and am experiencing
> some strange memory leaks. 
>
> If I execute this code, I have leaks only is I call SetInformationInput, 
> otherwise everything is fine. I looked in vtkImageReslice from what I 
> understood that image data is only use to read some parameters.
>
> Does anyone understand what is happening here? 
>
> Thanks!
>
> Here is my code:
>
> int main(int argc, char *argv[])
> {	
> 	vtkImageData* image = vtkImageData::New();
> 	vtkImageReslice* slicer = vtkImageReslice::New();
> 	
>  slicer->SetInput(image);
> 	slicer->SetInformationInput(image);    <<< This line causes the leak!!!
> 	
>  image->Delete();
> 	slicer->Delete();
> 	
>  return 0;
> }
>
> This is the console output if the SetInformationInput call is done:
>
> vtkDebugLeaks has detected LEAKS!
> Class "vtkCellData" has 1 instance still around.
> Class "vtkInformationVector" has 3 instances still around.
> Class "vtkPointData" has 1 instance still around.
> Class "vtkTrivialProducer" has 1 instance still around.
> Class "vtkPoints" has 8 instances still around.
> Class "vtkInformation" has 4 instances still around.
> Class "vtkLine" has 4 instances still around.
> Class "vtkInformationIntegerPointerValue" has 1 instance still around.
> Class "vtkPixel" has 2 instances still around.
> Class "vtkIdList" has 8 instances still around.
> Class "vtkDoubleArray" has 8 instances still around.
> Class "vtkAlgorithmOutput" has 1 instance still around.
> Class "vtkInformationIntegerValue" has 1 instance still around.
> Class "vtkVertex" has 1 instance still around.
> Class "vtkImageData" has 1 instance still around.
> Class "vtkInformationExecutivePortVectorValue" has 1 instance still around.
> Class "vtkVoxel" has 1 instance still around.
> Class "vtkFieldData" has 1 instance still around.
> Class "vtkStreamingDemandDrivenPipeline" has 1 instance still around.
> Class "vtkInformationExecutivePortValue" has 1 instance still around.
>
>
> Thanks a lot!
>
> Mathieu
>
>   




More information about the vtk-developers mailing list