Thanks Keith, the statement from Adobe is very helpful.
And you are right for your test, because your timer is created by "*new
Timer(30);"*
Do you see our original test, the timer is created by "*new Timer(500, 10)"*
That means, after 5 seconds, the timer will not be running, it's not same.
And, then i did more test with some modification of my original test, see
below, some times, the click handler will be collected now, especially you'v
clicked before the killing, if you'v not clicked, after twice killing, the
click handler is still active, now i just can guess -- the GC is really very
non-predictable, maybe, for some handler, we'd better remember to call
removeEventHandler than with weak reference:
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.net.LocalConnection;
import flash.utils.*;
public class TestDic extends Sprite{
public function TestDic(){
var timer:Timer = new Timer(500, 0);
timer.addEventListener(TimerEvent.TIMER, function(e:*):void{
trace("tick");
}, false, 0, true);
timer.start();
var h:Handler = new Handler();
stage.addEventListener(MouseEvent.CLICK, h.handler, false, 0, true);
setTimeout(killEm, 2000);
setTimeout(killEm, 4000);//kill again
}
private function killEm():void{
trace("kill.....");
try{
new LocalConnection().connect('foo');
new LocalConnection().connect('foo');
}catch (e:*){}
}
}
}
class Handler{
public function handler(e:*):void{
trace(e);
}
}
--
iiley
AsWing http://www.aswing.org
Personal http://www.iiley.com
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org