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?


2 Answers 2


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.


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.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .