I tried to find this but found nothing.

Does anyone know how to 'deallocate' textures/mipmap from glTexStorage2D once you don't need it anymore?

  • 1
    \$\begingroup\$ If you simply do not need it anymore, you can call glDeleteTextures(1, &textureID); on the texture. \$\endgroup\$
    – Lasse
    Oct 16, 2013 at 21:41

1 Answer 1


glDeleteTextures is the standard way to delete texture objects in OpenGL, but note that this isn't like malloc/free - glDeleteTextures only promises that the texture names become available for subsequent reuse, it says nothing about the actual memory used for storage, which will be driver-dependent behaviour.

Some drivers may keep the storage allocated so that they can reuse it for satisfying future allocations (rather than having to allocate new storage - a common misunderstanding this behaviour leads to is people thinking they have a memory leak), other drivers may not.

This is consistent with the API specification for all other GL objects; glGen* to create object names, glBind* to use them, glDelete* to make the names available for reuse. See e.g. glDeleteBuffers for another example.

So, actually releasing the backing storage is not something you need to worry about yourself; drivers will handle this automatically and you can work on the basis that the memory usage pattern is selected by the driver writers using their own knowledge of what's best for the hardware.


You must log in to answer this question.

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