6 Replies Latest reply on Nov 25, 2010 11:27 PM by Flex harUI

    VideoPlayer Memory Leak

    RandomReado Level 1

      This may be related to https://bugs.adobe.com/jira/browse/SDK-25785 but using the Profiler, I'm loading a custom component that uses the VideoPlayer component. When I change the VideoPlayer source, close the custom component then re-open it, the memory spikes by about 1,100KB.

       

      Is this a known issue or a new one?

        • 1. Re: VideoPlayer Memory Leak
          Flex harUI Adobe Employee

          Did the profiler show the same objects as stuck in memory?

          • 2. Re: VideoPlayer Memory Leak
            RandomReado Level 1

            Yes. In the Profiler when I load the VideoPlayer component, the MediaPlayer class appears in the list of Live Objects with an instance of 1. When I close the component and reload it without changing the source, the instance remains as 1 - the memory monitor shows the GC doing its job. However change the source, close the component and reopen it and the instance is 2. Repeat this process and the instance number and memory keeps increasing.

             

            In my project, setting the VideoPlayer source to "" was enough to cause it to stick in memory. Setting the source to null does nothing - i.e. the instance total continues to increase.

             

            This has been tested against Flex SDK 4.1 and 4.5 (latest stable release).

            • 3. Re: VideoPlayer Memory Leak
              Flex harUI Adobe Employee

              In the bug you referenced, there was more than one OSMF class leaking.  If

              you are not seeing the same, file a new bug, and/or use the profiler to

              investigate what is still referencing MediaPlayer.

              • 4. Re: VideoPlayer Memory Leak
                RandomReado Level 1

                The custom component is stuck in memory as well as the MediaPlayer according to the Profiler. So something is still referencing something, but I can't tell what.

                 

                I did a search on Google and found http://www.actionscript.org/forums/showthread.php3?t=250000. I tried the suggested fix, i.e. don't keep re-creating the component containing the VideoPlayer, and this worked. In my application I set:

                 

                private m:MyVideoPlayer;

                 

                Then when I try to open the popup containing the component, do:

                 

                m = (!m) ? new MyVideoPlayer() : m;

                 

                This seems to work - the MediaPlayer and MyVideoPlayer classes load once into memory and there doesn't appear to be any leaks that follow after opening/closing the component and setting the source of the VideoPlayer each time.

                • 5. Re: VideoPlayer Memory Leak
                  RandomReado Level 1

                  I just ran the profiler again with Task Manager open.

                   

                  Opening the component the profiler reported an increase of about 1.1MB in memory.

                   

                  Selecting a video the profiler memory increased slightly, but Task Manager reported a memory increase of about 20MB by the ADL.exe process. Selecting another video the profiler reports no increase in memory usage, but Task Manager reports another increase of 20MB. Repeating this process I managed to get the ADL.exe process to the point it was consuming 900MB of memory, but the profiler reported 5MB of memory used in total. The ADL.exe process hung at this point. The memory graph in Flash Builder was a straight line with no changes since the first memory increase.

                  • 6. Re: VideoPlayer Memory Leak
                    Flex harUI Adobe Employee

                    File a bug at bugs.adobe.com/jira