Avoid memory leakage


I would like to know the measures to be taken to avoid memory leakage use as far as  less memory for our application.
I am developing air application so memory management is very important factor..
As per my knowledge to avoid memory leakage ...
1. Remove event listeners when not needed
2. Nullify the objects i.e variables etc in order to clean objects...
3. Avoid using array collection...

Is there any other factors to be taken care of...
Let me know so that the air application does not crash...

Also i have plans to store data(might be huge amt of data which grows periodically and accessible only through my application) in user PC..so any special measures to be taken

Who is Participating?
ChristoferDutzConnect With a Mentor Commented:
From my experiance here some more:

4. In List/Tree-Based controls: Recycle wherever you can (If you use the itemRendererFunction property for example one item renderer instance is created for each item, If you use the itemRenderer property then flex/air creates and reuses only a few objects)
5. Reuse data wherever you can. If you have a user list in several places of your application try to load the list only once instead of for each list.

If you are really having problems, I'd suggest to utilize the Flash Builder Pro Memory Profiler (Think it's the only one available).
In Flash Player 10 I don't see problem with memory leakage.
But always good practice to remove event listener(s) if not need it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.