Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using OpenGL it is possible to load textures, buffer arrays, compiled shaders and more to the video memory. When a C++ program exits, heap memory that was allocated by it is cleaned. What happens to the stuff allocated on the video memory? Will memory leak beyond program's scope?

share|improve this question…. – user744 Jan 12 '11 at 18:51
up vote 2 down vote accepted

Your question was answered on SO:

Basically the answer is when your program exits, the memory should be cleared, so you will not have leaks.

You can test this by opening/closing multiple instances of your program without freeing the resources and verifying that your video memory usage stays the same.

However, as also mentioned in the link, you should of course get into the habit of freeing resources when they are no longer needed.

share|improve this answer

No. If the driver is written correctly, everything should be cleaned up just fine.

At least that's the theory. Drivers are rarely written 100% correctly; you may find on particular models of video cards, on particular OSs, you need to do some manual cleanup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.