From 72c3c6d0802919eb4d24a4ef19cc465e9fa8ff1b Mon Sep 17 00:00:00 2001 From: Jukka Kurkela Date: Fri, 14 Feb 2020 01:42:25 +0200 Subject: [PATCH] Fix memory leak (#7097) --- src/core/core.animator.js | 8 ++++++++ src/core/core.controller.js | 1 + 2 files changed, 9 insertions(+) diff --git a/src/core/core.animator.js b/src/core/core.animator.js index 28565629e45..1da3830391c 100644 --- a/src/core/core.animator.js +++ b/src/core/core.animator.js @@ -210,6 +210,14 @@ class Animator { anims.items = []; this._notify(chart, anims, Date.now(), 'complete'); } + + /** + * Remove chart from Animator + * @param {Chart} chart + */ + remove(chart) { + return this._charts.delete(chart); + } } const instance = new Animator(); diff --git a/src/core/core.controller.js b/src/core/core.controller.js index add55549b53..aca27dc759c 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -893,6 +893,7 @@ class Chart { let i, ilen; me.stop(); + Animator.remove(me); // dataset controllers need to cleanup associated data for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {