For anything that's going to eat up massive amounts of memory like 3D
models or textures I would recommend using object pools. Lost in
Actionscript has a nice Simple Pool class that you can use. It's quick
and easy.

The key as mentioned by Jensa is that object creation is expensive in
resources, both time and memory. Add events and you have a sure memory
leak. So a simple pool allows you to recycle objects rather then re-
create them. Where ever there is going to be the need for dynamic
instances ( new Something() ) then I would look into using a pool. You
ensure that only the X number of instances needed are in memory rather
then all the instances you created since the app started. As a general
rule you cannot guaranty flash will release memory footprint of
objects your app no longer use or need.

In a current project where I create hotspots based on XML data using a
pool allowed for memory to only increase when more hotspots are
created and it decreases when less are needed. It's not perfect but
it's predictable!

ath.

Jerome.


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to