Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
    
stackoverflow.com/questions/2215088/…. –  user744 Jan 12 '11 at 18:51

2 Answers 2

up vote 2 down vote accepted

Your question was answered on SO:

http://stackoverflow.com/questions/2215088/opengl-gpu-memory-cleanup-required

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

 
discard

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.