1 Reply Latest reply on Aug 6, 2010 5:55 AM by UbuntuPenguin

    ByteArray memory usage

    AdrianWiecek Level 3

      Hi all,

       

      I have strange problem using Flash Builder's Profiler and memory profiling of ByteArray.

       

      This is my test class:

      <?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"
         creationComplete="application1_creationCompleteHandler(event)">
      
      <fx:Script>
      <![CDATA[
      import arr.MyArray;
      
      import mx.events.FlexEvent;
      
      private var byteArray:ByteArray;
      
      protected function application1_creationCompleteHandler(event:FlexEvent):void
      {
           byteArray = new ByteArray();
           byteArray.writeBoolean(true);
           trace(byteArray.length);
      }
      
      ]]>
      </fx:Script>
      
      </s:Application>
      
      

       

       

      When i launch profiler it shows me one ByteArray instance existing in memory and its memory is 4176(0.58%).

      My question is why this ByteArray's size(contains one boolean) is more than 4kb, when an empty ByteArray's size is 80b?

       

      I'm using Mac Os X 10.5.8

       

      Regards,

      Adrian