Search code examples
c++openglmemory-managementvbomemory-pool

Memory pool algorithms


I am looking for smarter algorithms in handling VBOs in OpenGL.

As it stands, I currently store each of my models in 4MB VBO's. If the model is larger than 4MB, it is stored separately. The objects are stored such that the models are pooled together to decrease the number of binds.

The problem I am experiencing has been how to clean up unused VBO's, which are using only sparsely being used. Any resources on how I could better manage these memory pools is appreciated.


Solution

  • VBOs are not like regular memory, there is no need for any kind of sophisticated "memory management". You allocate a own, apropriately sized VBO for each distinct mesh and be done with. Any attempt to outsmart the driver will just result in inferior performance.

    Also there is no benefit in attempting to make your VBOs as large as possible. In fact modest sized VBOs of about 0.5k to 5k vertices in my experience work best.