actionscript 3 - Why isn't this garbage collected -
if create timer such as
var timer:timer = new timer(50, 0); timer.addeventlistener(timerevent.timer, ontimer); timer.start();
and function ends, think timer has gone out of scope , nil holding on reference of anymore. timer still works.
so either getting lucky , garbage collector hasn't run yet or holding on reference. if latter how know going garbage collected?
timer still run , dispatching events. declare way can access (as public instance variable) , perform:
timer.stop();
timer.removeeventlistener(timerevent.timer, ontimer);
- of import thing in flash timer = null;
- if need free memory, set reference null actionscript-3
No comments:
Post a Comment