Wednesday, March 9, 2011

Scaling a text field with styleshhet

For long time I thought this is some memory leak or something. All I had was a 2D carousel did in AS3, running continuously. All these carousel items had one image and some text. Running this carousel on Flash Player 10 was taking hell lot of CPU and physical memory (not RAM). Some times it went up to 15 GB and crashed application. What I observed was memory usage kept on moving up but it didn't come down even when I stopped this animation.

After weeks long debugging I finally figured out this is an issue with scaling dynamic text field with style-sheet. We decided to scale only image rather than image and text. So when you are observing high memory usage without any reason, make sure you are not scaling dynamic text field with style sheet assigned to it.