AnsweredAssumed Answered

How to force OpenGL texture/buffer memory to be freed?

Question asked by coordz on Feb 25, 2015
Latest reply on Mar 11, 2015 by

In our application, (rather large) texture and buffer resources are created and destroyed at various points during the course of execution. Sadly, these resources do not seem to be freed by the driver after the texture/buffer has been deleted leading to the GL eventually giving an out of memory error and dying a horrible death. Is it possible to force the driver to free the memory associated with a deleted texture/buffer?


So far I have tried:

- Making the texture/buffer a tiny size before deleting the resource.

- Doing a glFlush() and glFinish() after the delete.

- Swapping buffers.

- Drawing a simple triangle then swapping buffers.

- A number of combinations of the above to try to prompt the (lazy) driver to free the memory.


I fully understand the need for the driver to lazily free memory so as not to harm performance but not to free memory and force an out of memory error is, imho, a nasty bug.


One day we'll have a public Mantle interface and OGL Next so I can do the memory alloc/dealloc. Until then: how can I force the OGL driver to free memory that is associated with deleted resource?