actionscript 3 - How to trigger garbage collection? -
does know if it's possible apply garbage collection new stagevideo component in as3? have tried no success! code below:
if ( this._stagevideo == null ) { this._stagevideo = stage.stagevideos[0]; this._stagevideo.addeventlistener(stagevideoevent.render_state, stagevideostatechange); }
attempt @ gc:
this._stagevideo = null; this._stagevideo.removeeventlistener(stagevideoevent.render_state, stagevideostatechange);
this._stagevideo = null; this._stagevideo.removeeventlistener(stagevideoevent.render_state, stagevideostatechange)
i'm surprised worked, should throw exception, should first remove event listeners , nullify it's reference.
garbage collector not start every time nullify something, if can use flash builder profiler can attempt force gc, if want test out, can package project air, , call gc manually.
there bug/feature invoke gc if fail start localconnection twice (http://www.nbilyk.com/flash-garbage-collection):
try { new localconnection().connect('foo'); new localconnection().connect('foo'); } catch (e:error) {}
Comments
Post a Comment