I am wondering what are some good strategies to make sure I am definitely cleaning up all my GPU allocated memory when I exit a level. I plan to allocate/de-allocate on a per-level basis. I am using the OpenGL 4.x C++ API.
My thought was maybe:
1. measure GPU memory,
2. instantiate a level, then delete it
3. measure GPU memory again and verify that its the same amount.
I am not sure if functions exist to even accurately measure GPU memory used by a process.. I see there are some functions that I could use on my NVidia card, such as the one mentioned here: http://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/
but I think that only operates at the Kilobyte level...
Alternatively, I believe all the GPU memory allocated for my level will be local to my GL Context. So maybe I could delete and re-create the context, but I'd have to do this through SDL and wonder if this would be practical, or good practice to do between levels.
Suggestions and advice are appreciated!