OpenGL leaking memory?

Started by
1 comment, last by nts 19 years, 8 months ago
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?
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.
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

This topic is closed to new replies.

Advertisement