提交 0aeea993 编写于 作者: 1 100pah

Fix #4105 (memory leak)

上级 1b862d76
......@@ -142,6 +142,10 @@ define(function (require) {
this._firstRender = false;
},
dispose: function () {
this._controller && this._controller.dispose();
},
_focusNodeAdjacency: function (e) {
var data = this._model.getData();
var graph = data.graph;
......
......@@ -53,6 +53,11 @@ define(function (require) {
this.group.removeAll();
},
dispose: function () {
this._mapDraw && this._mapDraw.remove();
this._mapDraw = null;
},
_renderSymbols: function (mapModel, ecModel, api) {
var originalData = mapModel.originalData;
var group = this.group;
......
......@@ -386,7 +386,7 @@
_clearController: function () {
var controller = this._controller;
if (controller) {
controller.off('pan').off('zoom');
controller.dispose();
controller = null;
}
},
......
......@@ -36,6 +36,7 @@ define(function(require) {
var theCoordId = dataZoomInfo.coordId;
// Do clean when a dataZoom changes its target coordnate system.
// Avoid memory leak, dispose all not-used-registered.
zrUtil.each(store, function (record, coordId) {
var dataZoomInfos = record.dataZoomInfos;
if (dataZoomInfos[theDataZoomId]
......@@ -49,7 +50,6 @@ define(function(require) {
cleanStore(store);
var record = store[theCoordId];
// Create if needed.
if (!record) {
record = store[theCoordId] = {
......@@ -86,6 +86,7 @@ define(function(require) {
var store = giveStore(api);
zrUtil.each(store, function (record) {
record.controller.dispose();
var dataZoomInfos = record.dataZoomInfos;
if (dataZoomInfos[dataZoomId]) {
delete dataZoomInfos[dataZoomId];
......@@ -141,7 +142,7 @@ define(function(require) {
function cleanStore(store) {
zrUtil.each(store, function (record, coordId) {
if (!record.count) {
record.controller.off('pan').off('zoom');
record.controller.dispose();
delete store[coordId];
}
});
......
......@@ -32,6 +32,14 @@ define(function (require) {
}
this.group.silent = geoModel.get('silent');
},
remove: function () {
this._mapDraw && this._mapDraw.remove();
},
dispose: function () {
this._mapDraw && this._mapDraw.remove();
}
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册