strange SDL memory usage depending on bits per pixel
I have a very simple SDL program that uses only 1MB of memory with 32 bits per pixel, 2.4MB with 24 bits per pixel, 1.9MB with 16 bits per pixel, and 1.4MB with 8 bits per pixel. what is with this strange memory usage? why does the most开发者_如何学运维 bits per pixel take up the least amount of memory?
C++ GCC
thanks
Perhaps internal conversion buffers. If your surface bpp doesn't match your hardware surface you may need to store the full buffer in memory, whereas SDL may be able to use that surface directly otherwise. This is just a guess offhand.
But looking at a process in top or task manager may not be the best way to get a handle on what's using memory. If you're on Linux you can try a tool such as valgrind to get a very good idea of where memory is going.
精彩评论