Skip to content

Instantly share code, notes, and snippets.

@gonchar
Created April 4, 2015 20:48
Show Gist options
  • Save gonchar/7cc746a40ba52cf629ee to your computer and use it in GitHub Desktop.
Save gonchar/7cc746a40ba52cf629ee to your computer and use it in GitHub Desktop.
methodclosure object is not cleaned from memory
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.getTimer;
public class MethodClosureTest extends Sprite {
public function MethodClosureTest() {
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void {
var func:Function = function ():void {
var time:Number = getTimer();
trace("here: "+time);
};
func();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment