Skip to content

Commit

Permalink
Fixed leaking when tracking array changes
Browse files Browse the repository at this point in the history
The observableArray did leak the last value held by the observable when
subscribing for array change events, and then disposing the subscription.

The vlaue was being held by the closure held by the
arrayChangeSubscription. Setting it to null allows the GC to collect the
closure and the previousContents variable.

This commit fixes #2216
  • Loading branch information
decden committed Mar 29, 2017
1 parent 5f0b9a7 commit 89933a1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/subscribables/observableArray.changeTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ko.extenders['trackArrayChanges'] = function(target, options) {
underlyingNotifySubscribersFunction = undefined;
}
arrayChangeSubscription.dispose();
arrayChangeSubscription = null;
trackingChanges = false;
}
};
Expand Down

0 comments on commit 89933a1

Please sign in to comment.