[vtkusers] Memory leak
David Doria
daviddoria at gmail.com
Tue May 15 10:21:57 EDT 2012
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
More information about the vtkusers
mailing list