« Rich Media Redefined | Main | I'm not a friend of Ed's.. »
October 04, 2005
Flash 8 Garbage Collection
So when they release those articles on devnet, you probably shouldn't bookmark them intending to come back and read them when you have time to breathe and can ingest it. Just make the time now. Had I read the articles in detail, I would have immediately known what the issue was that I was troubleshooting.
When I heard about the new approach to garbage collection in the new Flash, i thought - that makes sense. I wasn't wary of it like I might be the new security sandbox restrictions - where you might have to make changes to accomodate for it. I thought great,improvement in performance, thank you very much MM. Today I ran into an issue tho, that had to do with the new garbage collection. Its pretty big to explain , but needless to say once I figured out the reference was still lingering about creating a problem - then it was pretty easy to solve. But it had me scratching my head - why would this be fine in flash 7 and not 8.
Makes me wonder how many other things will be affected as a result. In theory if you take out your own trash you don't have to depend so much on Flash cleaning up after you. Anyone experience new bugs as a result of the new garbage collection approach and if so what are they and how can they be avoided?
Posted by bitch at October 4, 2005 05:05 AM
Comments
It's been posted before, but the Context-Menu bug is a side-effect of the new GC. Specifically, if you make a new (local) ContextMenu, and then delete it before you click the ContextMenuItem, Flash will bail. It happens in all player scenarios, and is caused by Flash's too-eager GC deleting the reference before the CM is closed.
btn.onRollOver = function() {
// The following NEEDS to be declared as "var" to reproduce the bug
var cm = new ContextMenu();
cm.customItems.push(new ContextMenuItem("Crash Flash", nothing));
_root.menu = cm;
}
btn.onRollOut = function() {
_root.menu = new ContextMenu();
}
// Gotta make a dummy function or the CMI is ignored
function nothing() {}
Posted by: Lanny at October 4, 2005 06:50 PM
Post a comment