actionscript 3 - Detail lifespan of all ActionScript3 object -


i use actionscript3 develop web , mobile game. memory biggest enemy, don't know detail lifespan of objects. instance: bitmap know there "dispose" function of bitmapdata. always, dispose bitmap object using "bitmap.bitmapdata.dispose". however, wonder if reference of bitmap object becomes 0, gc free memory used object if don't call dispose function.

i have many questions above (sound, texture, basetexture...). has ideas topic?

the object's lifespan determined 1 single thing - if it's no longer referenced anywhere, it's considered dead (orphaned) , subject removed memory. yes, bitmapdata object removed memory without explicit dispose() call, if drop references it.

about sound or texture objects - these best being reused, example, can call mysound.play() multiple times, generate separate soundchannel object lifetime duration of sound, if it's unreferenced. likewise can use same texture object have multiple instances of being textured it.

there special rule concerning classes extend eventdispatcher, can listen events, , if not use weak reference object, event listener attached directly instance, making reference link prohibit gc recycling memory occupied object. should have total control on strong-reference listeners, @ least purpose.

hope helps.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -