flash - null an object kill reference or the space in memory -
this might dumb question. think know answer, clarify. if declare object in varible1 , pass value varible2. if decide null varible2 kill reference or object well. want no, again, reference self, affects space in memory.
these 2 varibles in class.
private var objects:array; private var viewableobjects:array;
above class varibles. later on in code add object objects array
objects[0][4] = new enemy1();
when trace following
[object enemy1]
i add viewable objects array
viewableobjects.push(objects[0]);
next remove it. later on down lines. looping through code see "i" in first element.
viewableobjects[i][4] = null;
and when trace same first varible "objects[0][4]"... shows
null
setting reference null
not affect object, unless it's last reference object (in case makes eligible garbage collection)
you might want read more on how references work.
Comments
Post a Comment