I am a flex programmer but i had nothing to do for handle manage memory in my projects. I think lack of memory management is reason for loading lag of swf file. Can any one help me to how to handle manage memory in flex/ as3 codes.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One of the most problematic uses of memory is not removing event listeners when you don’t need them anymore.
For instance
When you’re done with that button, remove the event listener so the owner of “doSomething” can be garbage collected. When you add an event listener to button, the owner of “doSomething”‘s reference count is +1’ed. Everytime you remove an event listener you -1 that reference count. To be garbage collected, the reference count has to be zero’d.
You can let the flash player do this for you (in most cases) by using weak-referenced event listeners, like so:
Here are some more tips to help your memory management: http://blog.skinkers.com/2010/10/08/memory-management-in-air-as3-flash-garbage-collection/
And if you want to learn about the garbage collector in detail, here’s a fantastic resource: http://jpauclair.net/2009/12/23/tamarin-part-iii-current-garbage-collector-in-flash-10-0/