|
-
garbage collecting
when you have an object 1that has another object2, and that object2 has a reference to object1, will they never be garbage collected? how do you remove them if you have this?
-
Senior Member
Even though you have two objects pointing to each other, if there are no pointers leading to one of the objects, starting from the main thread, then the garbage collector will (should) discover this and remove the objects.
A link for GC in flash 8: http://www.kaourantin.net/2005/09/ga...-player-8.html
-
so the references have to be from the document class, down? so if the main class doesn't have a reference to something that has a reference to some object thet object will be destroyed, no matter how many references it has?
are you sure?
-
Senior Member
Yes. In theory the garbage collector removes all objects than cant be traced from the main thred through references (No matter how many). Reality can sometimes be a little different, cause a garbage collector is no easy task implementing which means that errors may occure (and errors does occure). But as a flash programmer you should just make sure to erase the pointers for the objects, which you want to remove and pray for the rest
-
so i have to destroy the links between objects no matter what?
what do you mean a garbage collector is no easy task implementing? do you mean for the people that made flash, or for me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|