[vtkusers] Potential memory leak on render

Jonathan Morra jonmorra at gmail.com
Fri Apr 27 12:46:01 EDT 2012


 I tested all these memory problems by putting a break point on the
return0; line and noting the memory in the Windows Task Manager.

On Fri, Apr 27, 2012 at 9:46 AM, Xiaofeng Z <xf10036 at hotmail.com> wrote:

> How did you measure the memory usage?
>
> On Apr 27, 2012, at 12:23 PM, "Jonathan Morra" <jonmorra at gmail.com> wrote:
>
> > I'm running the following code on Windows 7 (both x86 and x64), and have
> noticed the following memory usages.  I think this implies some memory leak
> in the render call to VTK.  Can someone please let me know if they see this
> as well, and if so how to fix it.
> >
> > Thanks
> >
> > Here are my results
> > 0 Renders -- 9.852 M
> > 1 Render -- 29.28 M (I'm not sure if this jump is to be expected)
> > 10 Renders -- 29.76 M
> > 100 Renders -- 30.404 M
> > 1000 Renders -- 31.172 M
> > 10000 Renders -- 36.56 M
> > 100000 Renders -- 44.276 M
> >
> > Here is the code
> >
> > //* I tested all these memory problems by putting a break point on the
> return0; line and noting the memory in the Windows Task Manager.*
> > int main(int argc, char *argv[]) {
> >  vtkSmartPointer<vtkImageData> imageData =
> >    vtkSmartPointer<vtkImageData>::New();
> >  imageData->SetExtent(0, 100, 0, 100, 0, 100);
> >  imageData->SetOrigin(0, 0, 0);
> >  imageData->SetSpacing(1, 1, 1);
> >  imageData->AllocateScalars();
> >  imageData->GetPointData()->GetScalars()->FillComponent(0, 0);
> >  vtkSmartPointer<vtkImageViewer2> imageViewer =
> >    vtkSmartPointer<vtkImageViewer2>::New();
> >  imageViewer->SetInput(imageData);
> >  int numRenders = 100000;
> >  for (int i=0; i<numRenders; ++i) {
> >    imageViewer->Render();
> >  }
> >  return 0;
> > }
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120427/105da6ee/attachment.htm>


More information about the vtkusers mailing list