Tech Blog

Viewing Flash Player Memory Usage

Posted At : March 19, 2007 11:18 PM 3 Comments

While digging around the Flex 2 Langauage Reference I came across the System.totalMemory property.

According to the livedocs this gives:

The amount of memory (in bytes) currently in use by Adobe® Flash® Player.

This is a useful tool for monitoring memory usage while developing your applications and spotting memory leaks. To assist me in this for a current application I'm working on I created a very simple MemMon component. (Live Demo)

To use the component: 1. Download the MemMon.mxml component code to your system.

2. Create a new application in the same directory as the component

3. Paste in the following code with the following code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:local="*">
<local:MemMon />
</mx:Application>

4. Compile the application and enjoy.

Note: This does not report the memory for just your current application - it reports memory for the entire flash player - i.e. all open flash movies.

3 Comments

Marko Tomic 4/27/07 9:55 AM

Very useful indeed.

Thanks!

Marko

Gernot 12/15/08 7:24 AM

I get the following error on line 20 MemMon.xml

Element type "historyPoints" must be followed by either attribute specifications, ">" or "/>".

thanks

James 2/21/09 11:05 PM

I got the same error. You have to wrap the contents of the script tag in CDATA tags.