[vtkusers] QVTKWidget2 memory leak?

Clinton Stimpson clinton at elemtech.com
Fri Feb 24 16:29:22 EST 2012


On Friday, February 24, 2012 02:19:59 pm Jonathan Morra wrote:
> I have recently converted my app from using QVTKWidget to QVTKWidget2 so
> that I could paint on the QVTKWidget2 (which I was able to successfully
> do).  After this conversion my app started to leak memory terribly.  I
> followed the memory leak around, and found the culprit is the following
> line
> 
> glTexImage2D(GL_TEXTURE_2D, 0, internalFormat,
> 
>                    xsize, ysize, 0, format,
> 
>                    GL_UNSIGNED_BYTE, static_cast<const GLvoid *>(data));
> 
> 
> Which is in the following function
> 
> 
> void vtkOpenGLImageSliceMapper::RenderTexturedPolygon(
> 
>   vtkRenderer *ren, vtkImageProperty *property,
> 
>   vtkImageData *input, int extent[6], bool recursive)
> 
> 
> I am using a build that I got from git on January 10th.  I have a 64
> bit Windows 7 machine, but have built VTK with Microsoft Visual
> Studios 2008 32 bit.
> 
> 
> This bug is manifested everytime I call render on a QVTKWidget2 that I
> have placed a vtkImageViewer2 in.  This is a very critical bug for us
> as now our program runs out of memory very quickly because there are
> situations where render is called on every mouse move which means the
> program will die extremely fast.  Any help would be appreciated.
> 

Ok, I see the cause of the problem.

QVTKWidget2::Start() calls OpenGLInit(), which resets the context creation 
time and the vtkOpenGLImageSliceMapper reloads them thinking its a new 
context.

It would helpful if you can provide a minimal test case to demonstrate this.

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com



More information about the vtkusers mailing list