Jump to content
  • Advertisement
Sign in to follow this  
sebarnolds

OpenGL Strange OpenGL Memory Leak

This topic is 4694 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try locating every 'new' (eg. char* test = new char) command. Sometimes every frame a 'new' is declared, so they pile up

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!