Memory Leak in PlayerFramework

Topics: Windows 8 JavaScript
Feb 11, 2013 at 12:03 PM
Edited Feb 11, 2013 at 12:05 PM
Hi,

We have noticed that loading a video page with PlayerFramework and then going back to the original page leaks around 570K from memory.

We chased the problem and found the leaky part. Below, there is a fix that eliminates the leaks but I must accept that it is not a proper one.

Could you please review the patch and update the codebase with a proper fix for the problem?

Thanks.
@@ -1,4 +1,6 @@
-(function (undefined) {
+var theFlyoutContainerElementReference = null;
+
+(function (undefined) {
     "use strict";
 
     // Constants
@@ -4542,6 +4544,9 @@
                     this._element.innerHTML = "";
 
                     PlayerFramework.Utilities.removeElement(this._shimElement);
+                    PlayerFramework.Utilities.removeElement(theFlyoutContainerElementReference);
+
+                    this._observableMediaPlayer = null;
 
                     this._element = null;
                     this._flyoutContainerElement = null;
@@ -4700,6 +4705,7 @@
             },
 
             _initializePlugins: function () {
+
                 // instantiate plugins
                 for (var pluginKey in PlayerFramework.Plugins) {
                     var pluginType = PlayerFramework.Plugins[pluginKey];
@@ -5606,6 +5612,7 @@
             this._mediaQualityElement = PlayerFramework.Utilities.createElement(this._element, ["div", { "class": "pf-media-quality-control", "data-win-control": "PlayerFramework.UI.Indicator", "data-win-bind": "winControl.value: mediaQuality; winControl.label: mediaQualityLabel; winControl.tooltip: mediaQualityTooltip; winControl.disabled: isMediaQualityDisabled;" }]);
             
             this._flyoutContainerElement = PlayerFramework.Utilities.createElement(document.body, ["div", { "class": "pf-flyout-container" }]);
+            theFlyoutContainerElementReference = this._flyoutContainerElement;
             this._captionsMenuElement = PlayerFramework.Utilities.createElement(this._flyoutContainerElement, ["div", { "class": 
Coordinator
Feb 11, 2013 at 6:28 PM
Sorry you are encountering this issue. We've been able to identify and fix this leak already and will be releasing an update very shortly.
Feb 11, 2013 at 6:43 PM
Thanks for the prompt response. Update will be greatly appreciated but I have to release my app today. Is there a way for me to create a private version of PlayerFramework to release the app?
Coordinator
Feb 14, 2013 at 9:40 PM
For others: v1.1 was released this week with these memory leak fixes.