1 Reply Latest reply on Apr 21, 2010 9:47 AM by Flex harUI

    Flex3 Vector Graph Memory Usage Estimation



      Dear Sirs,


      I want to know when I using Flex3 graphics to draw rectangles, how will it consume the memory.



      For example, I have a code like this


      for (var outer:int = 0; outer < 25; outer ++){

        var canv:Canvas = new Canvas();

        canv.width = 100;

        canv.height = 100;

        for (var i:int = 0; i < 100; i ++){

          for (var j:int = 0; j < 100 ; j++) {





        var p:Point = new Point(int(outer/5) * 105, (outer%5)*105);





      I assume that each vector graph object would cost 68 bytes

      68 bytes comes from my “assumption” from following attributes of each vector graph object

      x: Number

      y: Number

      width: Number

      height: Number

      color: 8 bytes

      alpha: 8 bytes

      object overhead: 20 bytes

      And I assume it display on GUI would cost 8 bytes each pixel

      total = 76 bytes



      Therefore, each Canvas display container would display 10000 rectangles which cost less than 1 MB.

      For 25 Canvases, there would be 25 MB cost for graphs.



      Now, I add other factors:

      Browser: 25MB

      Flex Container + 25 Canvas Containers: 10 MB (or less)

      Then it totally should cost 60 MB.



      But in my test, this case would cost 150MB !!??



      I am confusing why there are so much extra memory cost?



      Anyone knows the exact formula to estimate vector graph memory usage?



      Futhermore, I have try using bitmapdata and bitmap to display my graph, but it’s not what I want, I actually need the vector graph features since my graph need to be zoomed.