Did the profiler show the same objects as stuck in memory?
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).
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.
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:
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.
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.
File a bug at bugs.adobe.com/jira