Cameron Yule

Text Layout Framework memory leak

Shortly before I flew to Abu Dhabi for Cityscape, I found a memory leak in the AIR application I’d been developing for the past few months. As with most memory leaks it only became apparent after several hours of usage, and given the application had to run at least 10 hours a day, was a serious problem.

Thankfully, Flex Builder has a profiler tool built-in, and leaving my application running for hours in the profiler revealed the rapid accumulation of instances of a mystery class TextAccImpl, which it’s package structure revealed was part of the new Text Layout Framework.

This was more problematic than you may imagine, as not only is the TLF still in beta, but was an integral part of my application as it gave us the ability to switch seamlessly between English and Arabic.

After spending time tweaking my code to check if I was using the API incorrectly, it became apparent it was a bug in TLF itself. Googling didn’t find anything, so I resorted to the official TLF blog, where I noticed a post announcing they were releasing weekly builds to their Adobe Labs download page.

As I was compiling against the version of TLF that came with the Flex 4 MAX Preview, I decided to upgrade by adding the latest weekly build (411 at that time) as an external library to my project. After making the necessary changes to my code to reflect the API changes they’d made, I left my application running in the profiler overnight and to my relief the bug had been fixed.

If anyone is experiencing dramatic degradation of performance over time after adding the TLF to your application, I’d recommend you upgrade to the latest weekly build.

Published on April 27, 2009 in Flash, Programming
Tags: , , , ,

Comments

Join the discussion by leaving a comment, or trackback from your own site. (Comment feed)

Andrew
27/04/2009

It’s that fear when the source of the bug moves from your code to THEIR code — the stuff you’ve been building off and kinda hoped you didn’t have to worry about.

Still, these things happen when you’re trailblazing! Can’t wait to hear more about it.

Unfortunately all I have to talk about is puppies.

Cameron
27/04/2009

Yup, that added to the fact their source is distributed as a pre-compiled binary (a SWC) so it’s not as if I could’ve programmed around it in the time I had available.

Lucky it worked out the way it did.

P.S. Your puppy is adorable!

Leave a comment

Comments are moderated, so be nice!