GDI Handle Leak

I frequently load textures by glGenTextures and delete textures by glDeleteTextures. GDI Handles continuously increases, the application slows down and at certain point it crashes throwing “Out of System Resources” exception. Any ideas how to overcome this problem?


You’re continually allocating a resource somewhere and never releasing it.

Most likely this is somewhere along your render path.

I’m rusty with GDI, but you should have a corresponding ReleaseDC() in any scope where you acquire a DC handle.

If your code isn’t too long, you might wanna post it here so we can have a looksy.