Been letting it run for a few hrs now and firefox is now using almost a gig
of memory.

Thanks, T

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Gregory
Boland
Sent: Thursday, October 01, 2009 3:39 PM
To: Flash Coders List
Subject: Re: [Flashcoders] [MEMORY LEAK]

TS,

what is the content that you are loading from this external swf every 30,000
milliseconds?  It is feasible that what you are loading is causing the
memory of the Flash player to increase?

I never saw where you ready the swf itself for garbage collection.  I see
that you are setting the loader to null but you still have the content on
the stage.  Although it looks like you are trying to remove something from
the display list at position 0.

Are you sure that you are removing what you are intending to remove?  Maybe
a more thorough emptying of the display list is in order such as a for loop
through the list, removing whatever might be on it.

And keep in mind that the garbage collection doesn't necc happen as soon as
you make something = null.  It happens on a garbage cycle when Flash feels
like it, not when u want it to.


"In Flash Player 9, the garbage collector's operations are deferred. This is
a very important thing to understand. Your objects will not be removed
immediately when all active references are deleted. Rather, they will be
removed at some indeterminate time in the future (from a developer
standpoint). The garbage collector uses a set of heuristics that look at the
RAM allocation and the size of the memory stack, among other things, to
determine when to run."
 -

http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html

greg


On Thu, Oct 1, 2009 at 5:00 PM, TS <sunnrun...@gmail.com> wrote:

> Yes I understand garbage collection(GC) and how it's "SUPPOSE" to work :)
> However, there still remains the fact that my browser is at say 146,000K
> private working set memory. Let my swf file sit there for a half hour or
> more and now the working set is up to 300,000K. Refresh the page that the
> swf is on and memory drops back to 146,000K. Now, turn off the mechanism
> that kills the content swf and re-adds it to the main swf and viola, the
> memory stays consistent at 146,000K.
>
> So, is this code not removing the content.swf appropriately on my Timer?
> Shouldn't GC be working appropriately and FF not adding additional memory?
>
> function timerHandler(event:TimerEvent):void {
>        trace(this.removeChildAt(0)); // remove from display list
>         mLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,
> onCompleteHandler); // clear from memory
>
> mLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,
> onProgressHandler);     // clear from memory
>        mLoader.unloadAndStop();// clear from memory
>        mLoader = null; // clear from memory
>         mLoader =  new Loader(); // clear from memory
>        startLoad();
>        trace("timerHandler: " + event);
> }
>
> Thanks, T
>
> PS I've been in IT since I was a kid and yes they still do mark the
sectors
> with a special character. The only secure erase from a drive is to do full
> format and go a step further by writing back on the drive with garbage
data
> many times over until your paranoid self can feel good about it. However,
> ultimately physically destroying the drive is the best way =)
>
>
>
> -----Original Message-----
> From: flashcoders-boun...@chattyfig.figleaf.com
> [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kerry
> Thompson
> Sent: Thursday, October 01, 2009 2:06 PM
> To: 'Flash Coders List'
> Subject: RE: [Flashcoders] [MEMORY LEAK]
>
> Juan Pablo Califano wrote:
>
> > The mere fact that the
> > memory footprint grows doesn't mean there's a leak.
>
> Juan Pablo is correct, and it's important to understand why. (If you
> already
> understand garbage collection, you need read no further, unless you want
to
> check the accuracy of my description :-)
>
> As you create objects, or even variables, the Flash player allocates
> memory--this is common to most runtime engines/virtual machines, including
> Shockwave, C#, Java, Visual Basic (I think), and all the way back to UCSD
> Pascal.
>
> When you delete an object, or a variable goes out of scope, that memory is
> no longer needed, and the Flash player notes that it is available for
> re-use. It does not, however, immediately re-use the memory--in fact, it
> probably doesn't even zero it out right away. The data are still there,
but
> the memory is marked as available.
>
> These memory blocks are often not contiguous--your memory looks something
> like a fragmented hard disk. You have a few bytes here, a couple K bytes
> there. When the Flash player's memory gets too fragmented, it does a
> "garbage collection". That is, it moves currently-valid objects and
> variables around to make everything contiguous (un-fragmented) again. It's
> much like defragmenting your hard drive, except it is done in RAM (or
> virtual RAM).
>
> The browser is probably doing the same thing. If the user has navigated
> away
> from your Flash page, it doesn't necessarily free that memory immediately.
> In fact, it probably won't, so you can still navigate forwards and
> backwards.
>
> It's sort of like deleting a file on your disk used to be. I think it's
> handled differently now, but in the bad old days, the OS would simply
write
> a special character into the first byte of the file. There were utilities
> we
> used to recover accidentally deleted files--we could explore the disk,
find
> the data, change the first byte back to what it was supposed to be, and
the
> file was restored. (That's somewhat simplified, but it's the right
> concept).
>
> HTH.
>
> Cordially,
>
> Kerry Thompson
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to