[vtkusers] Memory leak

David Doria daviddoria at gmail.com
Tue May 15 10:43:19 EDT 2012


On Tue, May 15, 2012 at 10:38 AM, Jothybasu Selvaraj
<jothybasu at gmail.com> wrote:
> Once I have done this step
>
>
>  vtkPNGReader* reader = vtkPNGReader::New();
>  reader->SetFileName("/home/
> doriad/test.png");
>  vtkSmartPointer<vtkImageData> img = vtkSmartPointer<vtkImageData>::New();
>  img->DeepCopy(reader->GetOutput());
>
>  reader->Delete();
>
> Is it safe to do?
>
> img->DeepCopy(reader2->GetOutput());//Some other reader
>
> Thanks
>
> Jothy

Sure. DeepCopy will just totally overwrite anything in 'img' with the argument.

David



More information about the vtkusers mailing list