PDA

View Full Version : Memory usage of htmlText string


Orrin
06-17-2008, 01:31 PM
I have an application which displays a growing amount of text in a TextArea component by concatenating the new text to the htmlText property.

In order to stop this property increasing indefinitely I am slicing off the beginning of the htmlText each time new data is received.

However the memory usage just keeps increasing as if the string were still growing. I can't seem to find a better way to do it, does anyone have any ideas please?

public function display(new:String):void {
var temp:String = output.htmlText + new;
var len:int = temp.length;
if (len > 50000) output.htmlText = temp.slice(len - 50000, len);
else output.htmlText = temp;
}