[vtkusers] Memory leak
Jothybasu Selvaraj
jothybasu at gmail.com
Tue May 15 10:27:43 EDT 2012
Thanks David!
Is it possible to copy the actual imageData from the reader and then delete
the reader.
As far as this is considered
vtkImageData* img = rd->GetOutput();
rd will stay in memory untill img goes out of scope.
is that correct?
On Tue, May 15, 2012 at 3:21 PM, David Doria <daviddoria at gmail.com> wrote:
> On Tue, May 15, 2012 at 10:19 AM, Jothybasu Selvaraj
> <jothybasu at gmail.com> wrote:
> > Hi all,
> >
> > I have a pipeline like this, every time I call this function the memory
> > increases ~10MB. How can I fix this?
>
> When you do this:
>
> vtkSmartPointer<vtkImageData>img=
> vtkSmartPointer<vtkImageData>::New();
> img=rd->GetOutput();
>
> You are chaging where 'img' is pointing. I don't think even smart
> pointers are smart enough to notice that. You need to instead do:
>
> vtkImageData* img = rd->GetOutput();
>
> (notice New() was never called for 'img') so that you aren't
> allocating memory for the image and then stranding it.
>
> David
>
--
Jothy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120515/97c7b1c7/attachment.htm>
More information about the vtkusers
mailing list