2 Replies Latest reply on Mar 8, 2011 8:17 AM by Laurentiu Pop

    How to reduce CompositionElements/RAM consumption, changing MediaElement won't release memory.

    msrustem

      Hello there,

       

       

      First of all thanks for such a great framework, its pretty nice architected and really helpfull.

       

      I've been using media composition elements In custom made player experience,

       

      What I came across and can't get rid off is memory usage by the flash player whilst media elements are in series and parallel.

       

      Whenever I try to remove media elements from composition element,

       

      or add/change/remove mediaElement it won't affect player to release memory.

       

      'nulling' player media reference, removing element from media container, also won't help.

       

      Aprox. adding up to twenty media elements causes 400-500 Mb of RAM usage, the more lements the more RAM..

       

      Could guru's tell me how can I reduce/avoid such an issue, any workaround? (Is that issue related to flash player VideoObject/NetStream scope thats out of OSMF?)

       

      Any advance will be apreciated.

      Thank you.

       

       


      Env. Flex SDK 4.1 + OSMF 1.5 release
      Pseudo code as follows:

       

         

       

      SomeMediaFactory

       

      {

       

      .. function constructMediaElement():MediaElement
      {
          var aggrElement:ParallelElement = new ParallelElement();
          var serial1:SerialElement = new SerialElement();
          var serial2:SerialElement = new SerialElement();
        
          var videoOfSerial1:LightweightVideoElement = new LightweightVideoElement(new URLResource("some.media1.mp4");
          var videoOfSerial2:LightweightVideoElement = new LightweightVideoElement(new URLResource("some.media2.mp4");
          ...
        
          //add to serial
          serial1.addChild(video1);
          serial1.addChild(video2);
          ...
          serial1.addChild(video5);
        
          serial2.addChild(video6);
          serial2.addChild(video7);
          ..
          serial2.addChild(video10);
          //add to parallel
          aggrElement.addChild(series1);
          aggrElement.addChild(series2);

       

          return aggrElement;
      }

       


      //release container and media
      ...function releaseMedia()
      {
          if (mediaPlayer.media)
              mediaContainer.removeMediaElement(mediaPlayer.media)
          mediaPlayer.media = null;   
      }

       

      ...function constructMedia()
      {
          releaseMedia();
          var newMedia:MediaElmnt = SomeMediaFactory.constructMediaElement();
          mediaPlayer.media = newMedia;
          mediaContainer.addMediaElement(newMedia)
         
      }

       

      ..function init()
      {
          constructMedia();
         
      .. function onSomeEventThatWeNeedChangeMediaSource()
      {   
           releaseMedia()..
           mediaPlayer.media = Somefactory.newMedia();