PDA

View Full Version : [INFOREQ] ModelManager does not remove references to implicit models



babsjr77
26 Nov 2012, 10:55 AM
My application creates quite a few Ext.data.Store.ImplicitModel objects which get stored in Ext.ModelManager.types object. These references are never getting removed once the model is no longer used.

evant
26 Nov 2012, 11:59 AM
How is it possible to know when it's no longer used? For example, let's say:



var store = new Ext.data.Store({
fields: ['name'],
data: [{
name: 'Item 1'
}]
});
var rec = store.first();
store.destroyStore();
// rec still in use

babsjr77
26 Nov 2012, 12:36 PM
The "rec" variable and its Model class is still valid after removing the link in ModelManager. It's just no longer tracked by ModelManager. As it stands now it's quite simple to create a leak without realizing it:



Ext.create('Ext.form.field.ComboBox', {
store : [ 'one', 'two' ]
});


Creates an implicit model class tracked by ModelManager and ClassManager. In my case, we have a large application which destroys and rebuilds components whenever a user moves between different panels. Overtime all these implicit models will generate a bunch of garbage objects.