Strange OpenGL Memory Leak

Started by
10 comments, last by Yann L 18 years, 5 months ago
Hi everybody. I use OpenGL at work when working on the company's engine. Until now, everything was working in 2D ortho mode (using glVertex2f) and everything was fine. I recently needed to use 3D coordinates too (glVertex3f). I discovered a problem : I have a memory leak in the application (it uses ~70Mo of virtual memory and it slowly grows). If I use the engine more intensively, the groth speeds up : it can be as much as 1Mo each 5-10s !!! I traced everything in the code and it seems that, if I don't call glVertex3f/glVertex2f, then everything is just fine (but nothing is drawn on the screen). The solution to this memory leak is to call glClear (even with glClear(0)) each frame. Does anybody have any idea about this ? I run a Dell PIV 3Ghz with 1Go RAM and a NVidia Quadra with 512Mo with Windows XP. I tried two different drivers versions. The only people who seems to have the same problem has an ATI gfx card and no one answered his post, read it here). Thanks.
Lead programmer of the (slowly evolving) syBR game engine --- http://sybr.sourceforge.net
Advertisement
Nobody has got the problem ?

Well, if it's the case then I suppose I will have to let this post be lost within the huge list of gamedev's posts...
Lead programmer of the (slowly evolving) syBR game engine --- http://sybr.sourceforge.net
Most programs typically do call glClear() once per frame, to at least clear the color buffer, so I guess it is remotely possible that the driver is using the glClear() call to free resources, but really that should happen on SwapBuffers() or at any rate on glFlush().

Try emailing NVidia about it, they should have a better idea than anyone why this happens.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

No, I tried it with a 50k polygon model, but didn't see any growth in the memory allocated to the application. I turned off depth testing and back face culling as well as not clearing the screen. I would say it is either specific to features you are using in the application or the driver for the card. If the program doesn't do it on an nVidia card then figure it is the driver. If it does the same thing there then figure it is some specific feature of the API you are using.

PS: Oops, thought you were running on a ATI card. I believe the Quadro drivers are differant than for the 6200 I'm using so while you are using a nVida driver already you might try it with a 6200, 6600, 6800 or 7800.
Keys to success: Ability, ambition and opportunity.
try running with glintercept
and a mem leak detector eg search for mmgr from paul nettle
I set this up with my basecode a while back, and it has been a godsend for keeping tabs on memory leaks.

http://www.flipcode.com/cgi-bin/fcarticles.cgi?show=63785
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
Hi !

Thanks for your remarks and suggestions.

There is only a small chance that the memory leak comes from my code because two people (me included) checked it thouroughly and we didn't find anything. So, I guess I will have to write to NVidia. I think I will also try glIntercept too.

Anyway, thanks all.
Lead programmer of the (slowly evolving) syBR game engine --- http://sybr.sourceforge.net
Try locating every 'new' (eg. char* test = new char) command. Sometimes every frame a 'new' is declared, so they pile up
make sure you delete your textures after you use them and that your only loading the textures one time

other than that it sounds like a non opengl related problem, check all you mallocs for paired frees other than that the only way to know for sure is if you post your code

btw, my first opengl project had your symptoms, it was because i was loading textures everyframe - that would work if i paired every call to glgentextures with gldeletetexture, slowly, but no leaks

make sure you call gldeletetexture after your finished with a texture, or
gldeletelist after your done with a display list

you probably are calling glgen something every frame

hope that helps
Are you using multiple threads or rendering contexts?
super genius

This topic is closed to new replies.

Advertisement