1.       The profiler post on my blog attempts to explain the difference 
between profiler memory, System.totalMemory and process memory.  Profiler 
memory is the memory attributed to AS properties.  The player has lots of other 
backing objects allocated in System.totalMemory.  Fonts and bitmaps have very 
small AS representations (a couple of slots for properties).  They are mostly 
buffers the player will use to render.

2.       It hasn't been proven, but my theory is that some of the memory 
attributed to XML is due to the string pool growing and not cleaning up 
properly. I do have confirmation that XML is not fully parsed.  Nodes are 
turned into structures on-demand so the amount of memory used by XML grows as 
you traverse it.  Also keep in mind that the player rarely, if ever, frees up 
memory pages because they usually end up sparsely populated so 
System.totalMemory won't always shrink as much as you would think

3.       I'd have to see it in context to remember what it means.  A method 
closure is the association of a method with an object.  If you see them in the 
profiler I think they are simply references to methods in a class.

4.       UnloadAndStop is not a giant hammer.  It simply stops various media 
streams as well as dereferences the SWF.  It does not free up every AS 
reference to objects in the SWF so it can't just punt a SWF from memory, you 
still have to clean those references up some other way.  A timer that is still 
on won't GC.  An object listening via weak reference will, but I was told 
recently that weak references don't get GC'd as quickly as other kinds of 
references.

HTH

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Jesse Warden
Sent: Thursday, October 22, 2009 6:46 AM
To: [email protected]
Subject: [flexcoders] Flex Profiler Questions



1. Why doesn't he show assets (bitmaps, fonts, ... the things that take the 
most RAM)?  Profiler reports 6 megs, but System.totalMemory reports 40 megs.  
No other SWF is open on the system beyond that one (so as not to pollute 
System.totalMemory accounting for multiple SWF's).

2. I had some XML accounting for 150 megs of 190 megs, yet the profiler didn't 
show it; said 21 megs.  I ran garbage collection multiple times in the 
profiler, but it still stayed around.  Why isn't it picking this massive chunk 
up?

3. What are "Method Closure"; event listeners?

4. Running code in Flash, I can confirm from both viewing memory via 
System.totalMemory + having a timer that traces out a message on every tick 
that a SWF is in fact unloaded from a Loader in Flash Player 10.  Running this 
code in the profiler shows the Loader never unloading (yes, I'm compiling for 
10 and yes I'm using unloadAndStop; remember, same code).  The profiler claims 
Loader still has it's instance around and the timer doesn't die with his weak 
listener... but does running in Flash.

Reply via email to