BIT-101 [2003-2017]

Keeping Flash 8 Garbage Collection in mind while programming


A while back, Tinic Uro posted some info about Flash 8 garbage collection. Link here. It was cool info, but it left me wondering if there is something we should be doing to make the most of its advantages, and avoid its drawbacks. Here is his answer:

One example: Particle systems. If you have objects representing particles, reuse the objects when they die instead of allocating new ones. Allocating large amounts of objects in a short time can kill the GC since unlike with the referencing counter model object are not freed right away anymore. So when objects die, put them into a recycle container from which you create more particles.

I ran into that earlier this week while programming. Seems like a good thing to keep in mind, so although Tinic already put it out there, it can’t hurt to make it more well known.

« Previous Post
Next Post »