Stupid question, but sometimes you need to ask it to move on.
Now that Timer is complete, I report the frame rate of the application. This means I do the following:
- Create a Text Node.
- set the Text to the frame rate EACH update cycle.
text.print("Frame rate " + timer.getFrameRate());
- When print is called, it causes the Text Node to assign this.text to the parameter text.
- So, there is an unused String object sitting out there, one for each update. This builds up to about 20,000 instances and then the garbage collector comes in. There is then a VERY noticable pause while the gc cleans up the mess.
Question is, how to keep this strings down? StringBuffer is my guess. But I also want it to be easy for the user. That is, creating a StringBuffer is not as nice is "Frame rate " + timer.getFrameRate()
Any suggestions?