PDA

View Full Version : Flex 3 memory profiler discrepancy


GUYINTHECHAIR
04-08-2008, 05:16 PM
I'm profiling our application in Flex 3, looking for memory hogs and leaks that might be causing the memory problems in our application. The Flex profiler says the application doesn't go above 25 megs of RAM, but the totalMemory (in flash.system.System.totalMemory) reports memory usage of anywhere from 100-300 megs depending on how heavily you are using the app.

I have tested this on Windows (IE, Firefox, Safari, Opera) and Mac (Safari, Firefox), and they all give the same results. When looking in the task manager in Windows and the activity monitor in Mac, I confirm that the browsers are using hundreds of megs of RAM, in line with what the flash player is reporting.

So what gives? Why does the Flex 3 profiler tell me the app is only using 25 megs when it's clearly using more? If it's the overhead from the Flex framework, and the stuff I've written is OK, is there anything I can do?

dr_zeus
04-08-2008, 05:55 PM
flash.system.System.totalMemory gives the total memory for all running instances of Flash Player. Do you have other browsers open with Flash content running? How about IM programs? Ads on MSN and AIM are often Flash.

GUYINTHECHAIR
04-08-2008, 07:28 PM
I use Pidgin and AdiumX for IM, so I don't see any ads there. I use an extensive hosts file on my mac and ad-block on Windows. When I'm testing in IE, thats the only window I have open.

Are there any studies on the effects of using mxml versus pure AS for components? I think this might be an issue.

dr_zeus
04-08-2008, 09:57 PM
In many cases, using MXML for components can actually be better for resource usage because certain controls aren't created until they are made visible by the user. This is called delayed instantiation. In other cases, it might be better to use ActionScript. For instance, subclassing UIComponent in AS is much cheaper than using a Canvas in MXML (since Canvas is a complex layout container).