Login  Register

Re: TextRenderer resource leak

Posted by slajar on Dec 21, 2014; 1:30pm
URL: https://forum.jogamp.org/TextRenderer-resource-leak-tp4033797p4033799.html

Hey Julien,


thanks for your fast answer.
Yes, you are right that's what your provided "patch" did, am I right? A caching mechanism.

Nevertheless, It is not limited in my application that means the user can create a textrenderer from any AWT font. On windows in is also using TTF files. So there is no limit and then multiply it by the sizes. On a vanilla Windows machine with no TTF installed I find approx. 50 ttf's. So multiplying it by let's say 100 different font sizes multiply by 4 font types (normal, bold, cursive, and I cant remember the english word)

50 * 100 * 4 = approx. 20000 possibilities.

Each uses Textures and therefore GPU-RAM. This is pretty bad, since I found that MacOSX doesn't free all textures at the end of a program run. They might say in GPU RAM.

That means even rerunning the software doesn't solve the leak. We have to be able to take care of it.

Actually, I believed that maually calling this would help:
 if( textRenderer!=null )
{
            textRenderer.flush();
            textRenderer.dispose();
            textRenderer = null;
}

After reading your posts on the internet I understood it will not ;) And after reading through the code of TextRenderer I understood why ;) There is no release code for the internal textures. Maybe it is enough to put glDeleteBuffers in the dispose code? From my current point of view I don't understand TextRenderer enough to provide a patch here.

any hints?

regards Matthias