I have a question about memory usage in openGL:
I am the developer of Ultimate Stunts (http://ultimatestunts.sf.net
), and I have an ATI radeon 9200 card with 128MB video RAM, and using the closed-source drivers from ATI. I discovered with top that Ultimate Stunts needed up to 197 MB virtual memory, and I would like to know where that comes from.
First of all, that 197 MB is a stable number, so it's not a memory leak (at least not in the game loop). So I tried to turn everything off (texturing, z-buffering, detailed geometry, ...), and I managed to get the memory usage down to 155 MB.
Then I tried running glxgears, which needed 150 MB. So it seems that nothing's wrong with Ultimate Stunts. The extra 5MB can come from a bigger executable, and sound samples.
The next thing I tried was to turn every feature on step by step. The results showed that most features didn't increase the memory usage, but that fully enabling the textures needed an extra 39 MB.
I calculated the size of the bitmaps, and even with 32 bits per pixel it only was 28 MB.
The questions are:
1: why is that 150 MB for openGL so big?
2: Does that 150 MB include my 128 MB video memory?
3: I expect the textures to be loaded into video memory. If the video memory is already assigned to the process, then why does loading textures increase the memory usage? Is this a normal RAM cache of the openGL driver?
4: Why is the extra required memory for the textures not equal to the calculated size?