我有加载存储和泄漏内存的问题。我有一个需要每5秒加载一次的存储。我使用DelayedTask来执行轮询。这个应用程序需要轮询,并将运行很长一段时间。该商店收回了一个相当大的JSON数据集,几个小时后达到了500MB。我在控制器中执行轮询。
我已经剥离了所有逻辑,只加载存储。不管我是使用DelayedTask还是setInterval,泄漏都是一样的。我查到了那家商店。负载逻辑。至少我是这么认为的。:)
我还从存储加载中删除了回调,并在加载事件侦听器中执行了task.delay。泄漏仍然存在。
所以,我不知道是我做错了,引入闭包还是这是一个bug?
我还使用Ext.Ajax每5秒提取一次数据。内存泄漏仍然存在,但它已经小得多了。
感谢任何帮助!
模型:
Ext.define('fimobile.model.myModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'a', type: 'string'},
{name: 'b', type: 'string'},
{name: 'c', type: 'string'},
{name: 'd', type: 'string'},
{name: 'e', type: 'string'},
{name: 'f', type: 'string'},
{name: 'g', type: 'string'},
{name: 'h', type: 'string'},
{name: 'i', type: 'string'},
{name: 'j', type: 'string'}
]
}
});
存储:
Ext.define('fimobile.store.myStore', {
extend: 'Ext.data.Store',
config: {
storeId: 'myStoreID',
model: 'app.model.myModel',
proxy: {
type: 'ajax',
url : url,
reader: {
type: 'json',
rootProperty: 'data',
successProperty: 'success'
}
},
autoLoad: true
}
});
控制器:
Ext.define('fimobile.controller.myController', {
extend: 'Ext.app.Controller',
config: {
views: ['myView'],
models: ['myModel'],
stores: ['myStore'],
refs: {
},
control: {
'myView': {
initialize: this.start
}
}
},
start: function () {
task = Ext.create('Ext.util.DelayedTask', function() {
this.getData();
}, this);
task.delay(5000);
},
getData: function() {
Ext.getStore('myStore').load({
scope: this,
callback : function(records, operation, success) {
console.log('callback');
task.delay(5000);
}
});
}
});
你为什么不把这个贴在bug Sencha论坛上?哪里是测试bug更明智的地方?