Skip navigation
Currently Being Moderated

How to interprit the System memory properties

Mar 13, 2011 4:10 PM

Dear Flash Player team,

 

Can you help me get the memory information I need from the properties made available? I have the same test running in desktop, mobile and browser and the information I'm getting back does not make any sense to me:

 

Desktop (Mac OSX):

System.totalMemoryNumber: 18.5MB

System.privateMemory: 17.7MB

System.freeMemory: 1.28MB

 

Mobile (Android):

System.totalMemoryNumber: 12.3MB

System.privateMemory: 23.9MB

System.freeMemory: 0.00737MB

 

Browser (Firefox Mac OSX Flex):

System.totalMemoryNumber: 32MB

System.privateMemory: 165MB

System.freeMemory: 1.52MB

 

Browser (Firefox Mac OSX ActionScript):

System.totalMemoryNumber: 17.9MB

System.privateMemory: 156MB

System.freeMemory: 1.51MB

 

 

What I'm trying to determine is what statements to use to determine the following.

 

How much memory my specific SWF instance in the browser or my specific AIR Application is using (not including the AIR or Flash Player runtime memory):

 

In AIR:

In Flash Player: (for example, System.freeMemory)

In AIR for Android:

 

How much memory the Flash Player or AIR Runtime is using (not including any SWF or application instances):

 

In AIR:

In Flash Player:

In AIR for Android:

 

How much the host device (pc, laptop, smart phone, etc) has total. On a laptop the total would be something like 4GB and on a phone 512MB.

 

In AIR:

In Flash Player:

In AIR for Android:

 

How much free memory a host device (pc, laptop, smart phone, etc) device has?

 

In AIR:

In Flash Player:

In AIR for Android:

 

 

Here is the code I'm using to test this:

 

AS:
package {
   
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.system.System;
    import flash.text.TextField;
    import flash.text.TextFormatAlign;
   
   
    public class MemoryTestForBrowserAS extends Sprite {
        public var memory:TextField;
       
        public function MemoryTestForBrowserAS()
        {
            memory = new TextField();
            memory.autoSize = TextFormatAlign.LEFT;
            addChild(memory);
           
            addEventListener(Event.ENTER_FRAME, windowedapplication1_enterFrameHandler);
        }
       
        protected function windowedapplication1_enterFrameHandler(event:Event):void {
            var text:String = "";
           
            text += "System.totalMemoryNumber: \t" + Number(System.totalMemoryNumber / 1000000).toPrecision(3) + "MB\n";
            text += "System.privateMemory: \t\t" + Number(System.privateMemory / 1000000).toPrecision(3) + "MB\n";
            text += "System.freeMemory: \t\t\t" + Number(System.freeMemory / 1000000).toPrecision(3) + "MB\n";
            memory.text = text;
        }
    }
}

 

Flex:

<?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"
               enterFrame="windowedapplication1_enterFrameHandler(event)">
   
    <fx:Script>
        <![CDATA[
            protected function windowedapplication1_enterFrameHandler(event:Event):void {
                var text:String = "";
               
                text += "System.totalMemoryNumber: \t" + Number(System.totalMemoryNumber / 1000000).toPrecision(3) + "MB\n";
                text += "System.privateMemory: \t\t" + Number(System.privateMemory / 1000000).toPrecision(3) + "MB\n";
                text += "System.freeMemory: \t\t" + Number(System.freeMemory / 1000000).toPrecision(3) + "MB\n";
                memory.text = text;
            }
        ]]>
    </fx:Script>
   
    <s:Label id="memory" width="100%" />
</s:Application>

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points