CPU load increases over time with text box update, what is wrong here?
I have a flash app that works fine at first but if I leave it on for about 2 hours the frame-rate drops right down and cpu usage goes up. Memory usage stays steady indefinitely. By commenting out different functions I found the line of code that seemed to be causing the problem - it was just a timed event occuring every 1/8th of a second, updating the contents of a text box.
To make sure this was definitely the problem I made this simple script on the first frame of an empty project (it simply had a dynamic text box on the stage named "subtitles"):
var subTimer:Timer = new Timer(1,0);
subTimer.start();
subTimer.addEventListener(TimerEvent.TIMER, normalSubDate);
function normalSubDate(event:TimerEvent):void
{
subtitles.text="some text";
}
In an attempt to speed up the process the timer is set to maximum speed, frame rate to 60 (I do not know if this makes a difference). I downloaded a performance monitor addon to give me updates on memory and frame-rate usage. Memory stays relitively constant , however after about 5-10 minutes the frame rate begins to drop steadily until it grinds to a halt. There must be a problem with the way I am using either the timer or the text box.
Thanks