A different OpenGL memory loss

I have an OpenGL program under Windows (2000/XP). It redraws to the screen @ 30 frames per second (fps). When the redraws include line drawing (GL_LINES or GL_LINE_STRIP and glVertex3f) of up to several thousand lines each.

I see the memory allocated for the program increasing approximately 4KB every few seconds. After several hours of operation, this can add up to lots of megabytes. Yet if the program is minimized and then restored, the extra memory allocated is freed. The memory allocation then begins again.

The memory loss does not occur if not drawing lines (commented out the glVertex3f calls).

As this program may run for several weeks unattended, the memory loss can get to be critical long before the program will have finished.

This memory loss happens under different video cards with different chipsets. It occurs under both Windows 2000 and Windows XP.

Where is the memory loss coming from? Why is it happening? And what can be done to eliminate it, short of turning the program into a completely Windows GDI/GUI program?

You are likely looking at the wrong memory measurement. In task manager you want to look at VM size. When you minimize an application, very often the operating system swaps out much of its memory to the virtual memory swap file. As the application is used, memory gets swapped back in when needed. You are probably looking at the Mem Usage column in task manager, or something similar, which only shows the physical memory currently in use by the process.

To summarize, your process may not actually have a memory leak. Check by looking at the VM Size column in task manager.

-Raystonn

You are correct, sir!

VM Size does not change at all.

Just the Mem Usage increases.

Well, I thought that all possible memory leaks had been eliminated, and they are.

Thanks, Raystonn.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.