Created
February 24, 2012 00:15
-
-
Save djcsdy/1896016 to your computer and use it in GitHub Desktop.
Object closure allocation in AS3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
function hatstand():void {} | |
function lampshade():void { | |
Tablecloth.onRemove(hatstand); // <- this allocates | |
} | |
} | |
class Foo { | |
var f:Function; | |
function Foo() { | |
f = hatstand; // <- this allocates | |
} | |
function hatstand():void {} | |
function lampshade():void { | |
Tablecloth.onRemove(f); // <- and this doesn't allocate | |
} | |
} | |
class Foo { | |
var f:Function; | |
function Foo() { | |
f = hatstand; // <- this allocates | |
} | |
function hatstand():void {} | |
function lampshade():void { | |
Tablecloth.onRemove(hatstand); // <- this doesn't allocate either, for some reason | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment