[osg-users] TextureBuffer memory not being released from GPU

Tom Marsland tom at appsincadd.co.uk
Fri Oct 6 04:39:22 PDT 2017


Thanks for the detailed response Robert.

I managed to get around the problem by switching to using Texture2D instead of TextureBuffers and increasing the size of the texture object pool. This seems to be a lot quicker as it's swapping the buffers around a lot better. I made a very simple database pager and it had the same issue so I'm pretty sure it wasn't the DatabasePager holding onto stuff. I did notice that the texture object pooling doesn't seem to work with TextureBuffers. 

I'm not 100% sure how it all works but it looks as though for a TextureBuffer, Texture::TextureObjectManager::generateTextureObject is never called with non-zero dimensions so in line 769 of Texture.cpp:


Code:
_parent->getCurrTexturePoolSize() += _profile._size;



_profile._size is always going to be zero so the pool size doesn't increase. This also means that line 728: 


Code:
_parent->hasSpace(_profile._size)



is always true so it never looks in the texture pool for an object and just keeps creating new ones. I'm not sure about why the memory wasn't being deleted though, i tried stepping through and it appears releaseGLObjects was called properly and it was flushing the objects properly, calling glDeleteTextures on line 639 of Texture.cpp and the availableTime was always enough, but the gpu memory still didn't go down until I quit the application.

Anyway, Texture2D works fine and is much quicker thanks to pooling so thanks for your help!

Tom[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72123#72123







More information about the osg-users mailing list