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.

Theo van der Sluijs

Theo van der Sluijs (1975) is Software Development Manager at Bax-shop.nl. You can read more in dutch on his “Dutch Blog“, he also created Gebruikmaar.nl. He is a member of the Board of the Dutch Flex Usergroup and Goesweb.net.

Google+ Twitter LinkedIn 



VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Related Posts

2 comments

  1. thanks for article

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  2. 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

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes