BIT-101 [2003-2017]

Does this code make my Flash look fat?


Flash apps are growing. Maybe growing up, but also growing fat. Back in the day, I never really gave a second thought about memory usage. I mean, when you could only have a few dozen movie clips on stage at any one time without the CPU choking and gasping for breath, memory was really not on the radar.

Now, with video, bitmaps and the raw speed of AS3, how an app uses memory is a very real issue. I was working on two apps recently where the amount of memory in use by the player was actually able to crash the player. In the first one, this was not a memory leak, but the shear amount of data (bitmaps) that needed to be stored in memory. I could calculate the size and number of each bitmap and plainly see that it was using the amount of memory it should. It was just too much. We actually had to scale back the app to make it safe for public consumption.

The second one was designed by someone else, with many flaws, and John Grden and I were called in to help fix it. In this case, we were able to refactor things to free up massive amounts of memory (and also reducing CPU load by a factor of maybe 200X as well). Before we stepped in, the project was stalled because it was melting the computer before even a fraction of the features could be implemented. Now it can get back on track.

In another small app I am working on, I noticed it used more and more CPU over time. In checking into that, I also noticed a memory leak in it, where the memory use slowly increased. I have a pretty good idea what’s going on there, and hopefully the two are related so I can kill both birds with a single stone.

Just an observation. That is all.

« Previous Post
Next Post »