Skip to content

Commit

Permalink
fix: Fix memory leak on SimpleAbrManager (shaka-project#5478)
Browse files Browse the repository at this point in the history
closes
[shaka-project#5477](shaka-project#5477)

Moving `this.onNetworkInformationChange_ = null;` before creating the
navigator.connection event listener.
Currently it resets it to null after creating the listener so the
release() wont be able to remove the eventlistener
  • Loading branch information
tyrelltle committed Aug 15, 2023
1 parent 4f1a119 commit e8f3ed0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/abr/simple_abr_manager.js
Expand Up @@ -48,6 +48,9 @@ shaka.abr.SimpleAbrManager = class {
/** @private {shaka.abr.EwmaBandwidthEstimator} */
this.bandwidthEstimator_ = new shaka.abr.EwmaBandwidthEstimator();

/** @private {?function():void} */
this.onNetworkInformationChange_ = null;

// Some browsers implement the Network Information API, which allows
// retrieving information about a user's network connection. We listen
// to the change event to be able to make quick changes in case the type
Expand Down Expand Up @@ -98,9 +101,6 @@ shaka.abr.SimpleAbrManager = class {
/** @private {ResizeObserver} */
this.resizeObserver_ = null;

/** @private {?function():void} */
this.onNetworkInformationChange_ = null;

/** @private {shaka.util.Timer} */
this.resizeObserverTimer_ = new shaka.util.Timer(() => {
if (this.config_.restrictToElementSize) {
Expand Down

0 comments on commit e8f3ed0

Please sign in to comment.