View Full Version : opengl memory leak on windows?

07-27-2006, 04:52 PM
Please be patient w/ me as I'm new to OpenGL... Currently I'm writing a program on NT using MFC. It allows for the opening and closing of several different windows. So, I'm making calls to get a device context, set the pixels, get a rendering context, make it current, draw w/ OpenGL, delete the rendering context, and then release the device context every time a window is opened and then closed. Using the Task Manager, it appears that I'm losing memory each time a window is opened and closed. More specifically, wglCreateContext() and wglMakeCurrent() consume more memory than wglDeleteContext() frees up. This program does the same thing on XP as well. Am I missing something? Does it have to be this way? Any suggestions?

Thanks for taking a look at this.

07-27-2006, 06:26 PM
If you use the same pixelformat for all windows you open, you can just create one single rendering context and bind it to different windows as needed.

Do you destroy your window upon closing or just hide it?

It may be a driver issue though...

07-28-2006, 08:48 AM
Using the same rendering context helps a ton! Thanks a lot! I appreciate it.