Skip to content

Commit

Permalink
Fix memory leak on destroy (#8438)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored Feb 16, 2021
1 parent b77f258 commit a6a1228
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/core.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,13 @@ export default class Config {

update(options) {
const config = this._config;
this.clearCache();
config.options = initOptions(config, options);
}

clearCache() {
this._scopeCache.clear();
this._resolverCache.clear();
config.options = initOptions(config, options);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ class Chart {
me._destroyDatasetMeta(i);
}

me.config.clearCache();

if (canvas) {
me.unbindEvents();
clearCanvas(canvas, ctx);
Expand Down

0 comments on commit a6a1228

Please sign in to comment.