Archive for September, 2008

Using the Flex Builder 3.x Profiler

I’ve been getting lots of questions about memory leaks lately. I finally found some time to put my techniques for analyzing memory leaks into writing.
Instead of using PowerPoint, I actually created a SWF so you can use the SWF to both view the presentation and learn how to use the Profiler. I cover the differences between profiler memory, System.totalMemory and process memory and show how I analyze the two most common memory leak scenarios.
Run Presentation
As usual, caveats apply.
The SWF also demonstrates an approach to another topic I’ve heard about often, and that is how to do XML-driven or data-driven UI. The presentation in this SWF is controlled by an XML file. A single engine parses the XML and creates the UI widgets as dictated by the XML. To change the presentation, all I have to do is change the XML. I can also add new widgets easily. Source is available here:
Download FlexBuilder Project
The SWF also demonstrates a technique for improving startup time. Because our blog system is painful to use, I don’t like uploading more than one or two files per blog post, but this presentation had more than a dozen images. So, instead of loading images externally, I embedded them into the SWF, but normally, that delays startup by the download time of all of those images. To get around that, I pack all the images into frame 3 of the SWF so that Flex can get up and running while the images download at the end of the SWF. I can get away with that because the images are not needed right away.
Hope this helps.