Hi everybody,
I have some big trouble with generating multiple, large sized fonts with libGDXs FreeTypeFontGenerator.
Why do I need to generate multiple, quite big BitmapFonts?
ATM I’m working on a graphical UI designer, in which you can create user interfaces for our Mystery Game Engine. Every size (Actors size and position, font sizes, …) can be specified by pixels, centimeters or percent. The problem is: If you create an Actor, which resizes depending on the stages size (lets say 40% of the stages height) and place some text on it with a height of 90% of the actors height, the fonts size changes each time the stage is resized. The stage is resized quite often, due to testing the GUIs resize behaviour.
With every font generation call the RAM usage raises depending on the font size (up to several hundred MB).
I made a little graphic which demonstrates what I’m doing:
http://img21.myimg.de/Ramusageexp739f4_thumb.jpg
What you can’t see here: I save the BitmapFonts in a list, but I clear that list before generating the new Font sizes and dispose all unneeded BitmapFonts.
What I do not understand is the fact, that the JavaVMs RAM allocation doesn’t raise, but the Processes RAM allocation does. If I repeat this code sample a few times my computer freezes since the java process consumes all of my RAM (6GB).
Any tips on how I can fix it? It seems like some native methods allocate the RAM but do not free it up again.
I hope you can help me,
twinflyer