|
-
Senior Member
garbage collection questions
If i create a contianer that holds several sprites like so.
PHP Code:
var sprCon = new Sprite();
addChild(sprCon);
var spr0:Sprite = new Sprite();
var spr1:Sprite = new Sprite();
var spr2:Sprite = new Sprite();
sprCon.addChild(spr0);
sprCon.addChild(spr1);
sprCon.addChild(spr2);
then if I remove sprCon all the children go with it but does that mark them for garbage collection or do I need to remove all refrences to those sprites inside the container also?
-
Bearded (M|G)od
You would need to remove the references to the children. Because for example, you remove sprCon. You could then turn around and do: myOtherSprite.addChild(spr0) without any problem.
-
Senior Member
ok i have another question about refrences to children that i remove ....if it is a textField and i have textField.style set do i have to unset that or set it null in order to get rid of a refrence ? exactly what is considered a refrence?
-
 Originally Posted by calmchess
ok i have another question about refrences to children that i remove ....if it is a textField and i have textField.style set do i have to unset that or set it null in order to get rid of a refrence ? exactly what is considered a refrence?
I am pretty sure you only have to make sure that nothing references textField.style like
b=textField.style;
b is a reference btw.
So if you did something like that do
b=null;
-
Senior Member
I need more help i have refrences such as tField.type = null ......and tField.x = null. but these refrences don't accept null as a value what do I do for those?
-
Try undefined or void - although I don't think you need to clear all the properties out for an object to get cleared. I believe the GC will mark and sweep entire groups of objects that are interconnected but otherwise unused by your code.
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
|