Jump to content
  • Advertisement
Sign in to follow this  
ktw6675

OpenGL OpenGL leaking memory?

This topic is 5147 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

I've been trying to nail down memory leaks in my game. I found http://www.flipcode.com/cgi-bin/msg.cgi?showThread=12September2000-PresentingAMemoryManager&forum=askmid&id=-1 on Flipcode. It was a great way to plug something in and watch the leaks be presented to you. I tracked them all down, and now that manager is showing no pointer leaks whatsoever, I ran my game and watched the "Mem Usage" in the Windows task manager as I ran my game. It was still going up! Is this a normal thing? There's lots of texture loading and unloading going on...is all the thrashing inevitably making that number go up, just because of the way Windows handles memory, or should it be staying relatively constant? My thought is that somehow OpenGL is leaking the memory--it'd be beyond the grasp of the memory manager. Is there a way to nail down OpenGL leaks?

Share this post


Link to post
Share on other sites
Advertisement
Windows sucks at maintaining memory for CPU intensive apps, atleast that's what i experienced.

I made a simple rendering app which optimized all data after it had been loaded, then it freed the old data's memory.
The memory would only be actually freed when i minimized the app (which causes a short break in the app's CPU usage).

You should try minimizing (or adding a sleep or delay command or whatever after deleting some data).

EDIT: I think it only works for minimizing as it will make windows put the memory you used in a swapfile (and probably unused memory will be freed), when your app gets de-minimized again it will slowly recall the memory so the memory usage will go up from a few KBytes to what your app actually uses.

And, unless your gfx card uses shared system memory (and even then it probably won't be yuor process that's allocating the texture and other opengl memory) it won't cause the task manager to display higher memory usage.

Are you deleting textures when they are not needed anymore? Or are you replacing their data? If you don't it won't cause your app's memory usage to increase but it will unneccesserily increase VRAM usage.

Share this post


Link to post
Share on other sites
I think I know what you mean, seen it happen myself as well. If you are not using multiple windows for rendering then take out the call to 'wglMakeCurrent' that for me was what made memory constantly go up, like 4kb a second i believe.

I might have called it in the wrong place not sure now though

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!