[vtkusers] vtkImageViewer memory usage

Suresh Joshi sureshj at gmail.com
Fri Jun 17 22:54:39 EDT 2011


Hello everyone,

Although I don't want to double post and spam the list, I haven't
heard any responses to a question I posted on May 27th, so I'll give
it another shot with some updated information:

My question is still the same and I'm wondering why my stock
vtkImageViewer pipeline (quoted below) is using around 50MB of memory
on my Windows 7 machine. The jpeg I am displaying is 400x400 pixels.

Also, if I were to create a separate
Renderer+Window+Interactor+Mapper+etc, the memory footprint should
still be the same, correct?

Thanks everyone!
-SJ


On Fri, May 27, 2011 at 3:06 PM, Suresh Joshi <sureshj at gmail.com> wrote:
> Hello all,
>
> I've done a fair bit of Googling, but haven't found many topics about this.
>
> In most of my applications dealing with ITK/VTK, I haven't cared too
> much about the memory used by the viewer, because I'd usually also
> have a 3D volumetric reconstruction/registration running at the same
> time, but for the first time I've taken note of the memory used by the
> viewer window itself.
>
> In a naive application (in C++ usually, but for instance in python here):
> *******
> reader = vtkJPEGReader()
> # 27kb JPEG file
> reader.SetFileName( "Albert-Einstein.jpg" )
> reader.Update()
>
> viewer = vtkImageViewer()
> viewer.SetInputConnection( read.GetOutputPort() )
>
> interactor = vtkRenderWindowInteractor()
> viewer.SetupInteractor( interactor )
>
> viewer.Render()
> interactor.Start()
> *******
>
> This 'program' seems to use about 50MB of memory on my Windows 7 box
> (with VTK 5.6). When I place these viewers (in c++) in my
> applications, I notice a similar usage...
>
> Now, the problem for me this time is that I need a less
> memory-intensive viewer, because I would like to instantiate multiple
> (lets say at least 10) vtkImageViewers in my app (yet, greedily, I
> would like to keep similar functionality, with interactions and all).
>
> So I guess I have a few questions:
> a) Is there any documentation anywhere discussing the memory
> footprints of the vtk viewers/viewports/windows/etc and discussing the
> best practices when it comes to keeping memory usage down?
> b) Is my naive approach of creating multiple vtkImageViewers the worst
> thing I can do (keeping in mind that it gives the exact functionality
> that I desire right now)?
> c) Should I be looking at having one renderWindow with multiple
> viewports instead, with one or more interactors? (And is this
> noticeably better?)
>
> Thanks everyone!
> -SJ
>



More information about the vtkusers mailing list