by Mike Welsh on September 18, 2011
I was talking with Ido about memory usage in AS3, and we discovered a small weakness in the AVM’s garbage collector. If you use a functional style of programming with lots of anonymous or nested functions, here’s something to watch out for:
import flash.display.Sprite;
import flash.events.Event;
function foo():* {
var sprite:Sprite = new Sprite();
sprite.addEventListener(Event.ENTER_FRAME, tick);
// this closure creates a reference to the outer scope, foo
return function():void { }
}
function tick(event:Event):void {
trace("tick");
}
var func:* = foo();
System.gc();
// sprite is never garbage collected, and continues to tick
sprite will not be garbage collected, even though it’s just a local variable of foo and no other references to it exist!
[click to continue…]
by Mike Welsh on June 4, 2011
My buddies Shawn Tanner and Michael Swain have released Skincraft, an awesome editor for Minecraft. Check it out on Newgrounds:
Skincraft
I helped out with the 3D display of the Minecraft character, as well as the file sharing features of the Newgrounds API that allow people to upload their skins. I’ve been hard at work on the Newgrounds API for several months, and I think this is one of the best examples of it yet!
by Mike Welsh on March 27, 2011
by Mike Welsh on March 18, 2011
I don’t have many memories from when I was very young, but one sticks out clearly in my mind. My mom was shopping at the mall, with my brother and me in tow. As we walked past the Hills department store, a blast of electronic noise caught my ear. An arcade had opened in the mall, and like moths to flame, my brother and I stormed into it. To a kid, no experience is quite as visceral as walking into an arcade. And the first thing I saw was this:
[click to continue…]