| Ultrashock Forums
• AS3 - Objects and Performance |
|||
![]() |
||||
| Search this Thread | Thread Tools | Display Modes |
|
|
|||||||||||||||||||||||||
![]() |
Ultrashock Member Comments:
|
2008-07-22
#2 |
||
|
By not assigning a variable to it you have no way of removing it from memory. It would definitely be wise to assign a variable which will allow you to target the object and remove from memory.
|
|
|
2008-07-22
#3 |
||
|
Thanks Isocase, Here's another thought. Wouldn't garbage collector delete an object that is not assigned to a variable? |
|
17 Creative Assets
|
2008-07-22
#4 |
||
|
It depends what you are doing inside that class. It will stay in memory if it is being referenced by any other objects or referenced by itself (i.e. by using a static property), or if any of it's methods have been registered as strong event listeners. If an object isn't referenced then it should eventually be cleared from memory.
|
|
|
2008-07-23
#5 |
||
|
Last edited by M40 : 2008-07-23 at 13:36.
Thanks Nutrox, very useful post as always! A few more questions if I may. 1. If an object it not assigned to a variable, can it be referenced by another object? 2. Is there any way I can check if an object that is not assigned to a variable in memory? 3. How long an Event object stay in memory? Here's an example. If you dispatch an event the following way - dispatchEvent(new Event()), how long does that Event object exist in memory? Thank you! |
|
17 Creative Assets
|
2008-07-23
#6 |
||
|
1. The short answer is no. If you lose all references to an object then it is lost, there would be no way of referencing that object again. The Array in the following example could never be referenced again: Code:
new Array(); 3. It is difficult to answer that one, not many Adobe peeps can answer it either. Flash runs a garbage collection when it thinks it needs to, normally when memory usage fluctuates quite a bit, but it isn't predictable or consistent.
|
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|


5 comments
| 813 views



17 Creative Assets
Linear Mode