Memory usage of the current Flex/Actionscript application
System.totalMemory shows the memory usage of the all instances of all flash/AIR applications in the system. 开发者_Go百科Is there a way to find the memory usage of only the current application? Also even if I have only one instance of an application, and I close/relaunch it several times, System.totalMemory increases almost exponentially.
If you have access to Flex Builder Professional you can do this with the profiler.
I Flex Builder, click Profile > Profile External Application. Cĺick 'New' and browse to the application, select the application and click 'Launch'. When the application starts, Flex Builder will pop up a dialog, check "Enable memory profiling" and uncheck "Enable performance profiling". There will be a tab called "Memory Usage" with a graph of the memory usage for the application over time.
As Markus said the Flex Profiler offers a really great way to profile your applications. If you don't have Flex Builder... if you're on a mac I would suggest the system profiler, and if you're on windows i would suggest process explorer.
精彩评论