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.

About the author

Theo van der Sluijs Theo van der Sluijs (1975) is Lead Developer at Unitrust BV. He is also creator of "I Am Bored So I blog" / Gebruikmaar.nl / vanderSluijs.nl. He is a member of the Board of the Dutch Flex Usergroup and Goesweb.net. With his quote "Never Give Up, Never Surrender" (Actually stolen from Galaxy Quest) he fights his way through the day. Connect with him on Twitter.

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 0 votes)

Leave a Reply

QR Code
Donate

Like the information on my site? Please donate for a cup of coffee, or give a bit more for a cappuccino.

Twitter
Get Adobe Flash playerPlugin by wpburn.com wordpress themes