[Interest] Memory Leak in Graphic Card. OpenGL.

Samuel Rødal samuel.rodal at digia.com
Wed Jan 23 09:36:47 CET 2013


On 01/22/2013 12:47 PM, Guido Seifert wrote:
> Hi, could anyone help me with my OpenGL problem? Either it is a bug in the Qt OpenGL libs, or it is me. Most likely it is me. I am quite the beginner with OpenGL.
>
> The code:
> http://pastebin.com/wQByE92h

It seems a bit dubious that you have an initializeGL() function that 
will be called both by QGLWidget and by your own code, in different 
contexts. Also calling the function paintGL() is a bit confusing since 
QGLWidget also has a paintGL() with a different signature, but that 
shouldn't really be an issue.

> The getImage function is called thousand of times over hrs. Exactly that's what I wish. My program runs perfectly, but crashes reliably after ~3.5hrs.
>
> Finally I discovered a memory leak. Not in my main memory, but in my graphics card memory. I discovered it when I installed GPU-Z (http://www.techpowerup.com/gpuz/).
>
> So it looks like the deletion of the QGLPixelBuffer does not really clean up all resources. But when I activate the deleteTexture methods, I get strange warnings
> (QGLContext::makeCurrent() failed), which I would be willing to ignore, but also random crashes, which of course I am not willing to ignore.

Which Qt version? Maybe as you say QGLPixelBuffer is forgetting to do 
some clean up, though it _could_ also be a bug in the GL driver.

deleteTexture resulting in warnings shouldn't really happen, sounds like 
a bug.

Btw, GL draw lists are not really recommended for use these days.


> I am thinking to drop the whole QtOpenGL stuff and use plain OpenGL, though this isn't a very satisfying solution.

Alternatively you can report the issues you find to the bug tracker and 
help fix them in Qt, if you're capable of rewriting it yourself in the 
first place.

--
Samuel



More information about the Interest mailing list