VRAM and RAM Usage


I have faced with a problem within our application. I’ll try to explain:
1.Assume we have 512Mb of VRAM (Quadro FX 4500, in our case)
2.Assume we have all VRAM full at some point
3.Now I start allocating more textures (somewhat 200Mb)
During these allocations – we no longer have spare VideoRAM – what does the video driver do in this case? I did not find any documentation that definitely tells what happens in this case – from what I observe - I believe that video driver moves some other textures (assuming - the ones that were used long ago) into main RAM and uses just freed VideoRAM for allocating new textures. When I try to bind those old textures – the driver again moves them back to VideoRAM, moving other textures to main RAM. Is that true?
4.At some point I start clearing the cache thus deleting the textures
5.VRAM gets freed, BUT: the system RAM that was used by video driver for storing textures does NOT get freed – it stays allocated within the process and is later reused by video driver in case of need. Is that true?

Did anyody ever face with the issues like that? Is there any way for releasing main RAM allocated by vide driver via OpenGL API?


It depends on implementation, but in most cases (NV and ATI) driver have copy of texture in RAM and VRAM, and simply trash VRAM copy if its running out of VRAM memory. If app asks too much then some of textures can be swapped-out to page file.

There is no way to release RAM copy of textures.

When you call glDeleteTextures, the driver should free all allocated texture data (RAM if exists and VRAM) related to the given texture name(s). If it doesn’t there is a problem! :slight_smile: But you should not have to care about that.