Thanks Ian, What you've said is the principles we were working on here... the problem we have is that if you're playing a game (which, in itself is fairly processor-intensive) and you leave the game to return to the lobby - and then play another game - when the second game is created the whole thing behaves as if two games are playing - as if the old game was never destroyed but is somehow playing 'in the background' - but listing objects when you're back in the lobby shows there's nothing there. FP8 gives you the glorious 'script running slowly' alert but FP7 and FP9 continue to run, just more slowly.
So what I thought *might* have been happening was that, despite a heroic effort by one of my colleagues to hunt down and '=null' every reference in every class he could find, because there was suddenly a huge amount of free memory the GC was not triggered, so, when the player moves from lobby to second game those objects are still in memory, and that - having the same names as references was somehow 'resurrecting' them - some sort of Frankenstein object reference! Arrrggghhh. Seems unlikely, I know, but it's got us all foxed as to what's actually going on here - and as it doesn't happen in FP7 or FP9 it's a little confusing and GC in FP8 seemed like a likely culprit.... Any thoughts, ideas, suggestions (despite just throwing in the towel and going freelance) ? T -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: 09 November 2006 11:12 To: Flashcoders mailing list Subject: Re: [Flashcoders] Garbage Collection in FP8 On 11/9/06, Trevor Burton <[EMAIL PROTECTED]> wrote: > Can anyone point me to some solid information about FP8's Garbage Collection > process? I read the article here - > http://www.kaourantin.net/2005/09/garbage-collection-in-flash-player-8.html > but i'm looking for some more in-depth stuff. or perhaps there's a tool to > view the GC working? > > I'm working on a fairly processor-intensive app and am having problems > getting rid of unused objects before replacing them. Flash is telling me > they've been removed but my computer's processor is telling me different! Hi Trevor, Having old/unused objects around shouldn't affect the processor load much, unless those objects are actually _doing_ something - being animated, executing code once a frame, executing code on an interval, making http requests etc., or being iterated through by your code for some reason. The only way that 'inactive' objects should mash the processor is if they are pushing the memory requirements way up and thrashing your machine in disk-swapping. I think there are, somewhere (Google it - I'm afraid I can't remember, as I don't use them), tricks/hacks for making the GC fire. All I can suggest is that before deleting an object you make sure you've stopped it doing anything that it shouldn't be doing - see my list at the beginning of the mail. :-) How are you deleting objects? A simple 'delete' doesn't do it, if there are other outstanding references to the object; in fact, delete is a bit of pointless keyword. It doesn't work in any way like the C++ delete operator; its only real use is to kill off a property on an object. You've got to clear all references, or the object still hangs around. Quick example: var a=new Object(); myObject.someProp=a; trace(myObject.someProp); // (object) delete myObject.someProp; trace(myObject.someProp); // undefined trace(a); // (object) - it still exists! a=null; // Could achieve the same thing with delete a Now the object created on the first line is elegible for destruction, whenever Flash's GC gets around to it. As an aside, if I'd put myObject.someProp=null in there instead of delete myObject.someProp, it'd all be pretty much the same; only difference is if I did a for...in on myObject the key 'someProp' would still exist. HTH, Ian _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com