Skip navigation
KrisKohlstedt
Currently Being Moderated

Memory limitations in the flash player

Aug 18, 2009 3:33 PM

I've been running into some memory limitations in a flex application that I'm working on.  As a test I wrote the code below to try and determine what the true memory limitations of a flex application running in the flash player are.  What I've found is the following.  On both the windows and linux machines there is a total of 4G of space available and in none of these cases was the OS near hitting the physical memory limit.

 

Max memory usage on various configurations:

 

flash player 10 on windows = ~650M

flash player 9 on windows = ~800M

flash player 10 on linux = unlimited (I was able to get up to 2.5G without any problems)

 

Has anyone else run into these limitations?  Can anyone comment on possible work arounds to these limitations or provide any insight on why the flash player would have an artificial memory limit below what the OS can provide?

 

 

In the following application each button click takes up about 100M making it fairly easy to see at what point the flash player is crapping out.

 

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
     xmlns:mx="http://www.adobe.com/2006/mxml"
      minHeight="600" minWidth="800">

     <mx:Script>
         <![CDATA[
                 import mx.formatters.NumberFormatter;
       
                 var outer:Array = new Array(1000);
                 var outerCnt:int = 0;
                 private const MBYTE : int = 1024 * 1024;
             private function onButtonClick():void {
                 var inner:Array = new Array(5000000);
                 var formatter:NumberFormatter = new NumberFormatter();
                 formatter.useThousandsSeparator = true;
                 var cnt:int = 0;
                 for(var i:int=0;i<50000000;i++) {
                     inner[cnt++] = "testsstringtestsstringtestsstringtestsstringtestsstringtestsstringte stsstringtestsstringtestsstringtestsstring";
                       
                 }
               
                 outer[outerCnt++] = inner;
               
                 text.text = formatter.format(flash.system.System.totalMemory/MBYTE);
             }
          

         ]]>
     </mx:Script>
     <mx:Button id="btnConfirmSubmit" click="onButtonClick()" label="click me"/>
     <mx:Text id="text"/>

</mx:Application>

 
Replies
  • Currently Being Moderated
    Aug 18, 2009 4:11 PM   in reply to KrisKohlstedt

    What error did you get at the limit?  System.totalMemory is not the same as total process memory.  See my blog for details?

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2009 7:52 AM   in reply to KrisKohlstedt

    There's a post on how to use the profiler that explains the difference between System.totalMemory and process memory.  There may also be a limit on how much memory plug-ins can use, but I'd say that if you've used up 500MB, that's quite a bit and some sort of memory management strategy is in order.  Otherwise, if the customer is using your app along with Excel and some other biggies, there'll be lots of thrashing.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2009 9:44 AM   in reply to KrisKohlstedt

    Like I said, System.totalMemory is not the same as process memory (and can be a fraction of total process memory).  What kind of process memory do you see when System.totalMemory is at 500MB?  AFAIK, the player has no official limits but the plug-in browser hosts might.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 20, 2009 4:41 PM   in reply to KrisKohlstedt

    Each browser has its own plug-in architecture.  Each browser may be imposing limits.  The only workarounds I would suggest are ones that would get your app to run in less than 200MB.  Unless you're hosting on a kiosk, that's quite a load to take against other apps running on the same system.

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 21, 2009 8:14 AM   in reply to KrisKohlstedt

    It probably isn't a design issue.  We have to live in browsers.  Did you try the standalone player or AIR?

     

    Alex Harui

    Flex SDK Developer

    Adobe Systems Inc.

    Blog: http://blogs.adobe.com/aharui

     
    |
    Mark as:

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