Read out system memory using Adobe Flex
So you have a application, and you want to know how much it takes of your (or the users) system memory ?
Easy, just use the following code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" width="659" height="352"
creationComplete="SySMem();">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
public function SySMem():void{
var memoryUsedInKb:int = int(System.totalMemory / 1024);
lblSysMem.text = memoryUsedInKb.toString()+" KB";
}
]]>
</fx:Script>
<s:Label text="Label" width="185" id="lblSysMem" left="5" top="5"/>
</s:Application>
But be aware this code show the totalMemory of all instances of flash objects opened at that moment.
So if you want to test if correctly close all other flash objects within all browsers and also AIR Applications.





thanks for article
This really is certainly extremely helpful since I am currently building an online flower weblog – although I’m in the beginning stages therefore it’s even now very small, nothing like your blog. It’d be great link to a few of the content here as they are very interesting. Thanks much. Isabella Simpson