Ack. Используя OpenLayers, у меня есть Ext.form.ComboBox, который запускает запрос Ext.data.JsonStore для доступа к шейп-файлу ~ 1 Гб и возвращает таблицу результатов. Затем пользователь может выбрать один из результатов и масштабирование карты в этом месте.Запрос хранилища OpenLayers Ext.form.ComboBox создает утечку памяти
Это отлично работает. НО! Как используются ComboBox, размер JVM продолжает grow- утечки памяти - и Geoserver бросает много вопросов, в основном все связанных с:
Caused by: java.io.IOException: Map failed
Caused by: java.lang.OutOfMemoryError: Map failed
ERROR [geotools.map] - Call MapContent dispose() to prevent memory leaks
я могу запустить ComboBox целых пять раз в течение примерно одной минуты до буря ошибок перегружает Geoserver (например, GetFeatureInfo не возвращает никаких результатов, запрос ComboBox возвращается пустым, появляются розовые плитки, EDIT: и GWC перестает создавать новые плитки!).
Нужно ли уничтожить() или очистить магазин или ...? и как? Мысли ??
GeoExt 1.1, OpenLayers 2.12.rc6, внешн 3.4, внешн 4.2.1.883, JQuery-1.6, Geoserver 2.5, JDK i586 v7, Tomcat 7
Код:
запрос: смотрит вверх, что является введенном в ComboBox & населяет Сохранять
Ext.onReady(function() {
Ext.override(Ext.form.ComboBox, {
doQuery: function(q, forceAll) {
console.log('queryTpl', this.queryTpl, q);
q = Ext.isEmpty(q) ? '' : q;
var qe = {
query: q,
forceAll: forceAll,
combo: this,
cancel: false
};
if (this.fireEvent('beforequery', qe) === false || qe.cancel) {
return false;
}
q = qe.query;
forceAll = qe.forceAll;
if (forceAll === true || (q.length >= this.minChars)) {
if (this.lastQuery !== q) {
this.lastQuery = q;
if (this.mode == 'local') {
this.selectedIndex = -1;
if (forceAll) {
this.store.clearFilter();
} else {
this.store.filter(this.displayField, q);
}
this.onLoad();
} else {
this.store.baseParams[this.queryParam] = this.queryTpl ? String.format(this.queryTpl, q) : q;
this.store.load({
params: this.getParams(q)
});
this.expand();
}
} else {
this.selectedIndex = -1;
this.onLoad();
}
}
},
});
})
в магазине
var dsm = new Ext.data.JsonStore({
remoteFilter: true,
autoLoad: false,
autoDestroy: true, // doesn't appear to help
url: '../geoserver/workspace', // generalized, not for public access
storeId: 'myStore2',
baseParams: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typeName: 'MRDS_LUT', // *shp in geoserver defined by var
srsName: 'EPSG:4326',
outputFormat: 'json',
propertyName: 'SiteName,Municipal,Commodity,Status,Longitude,Latitude'
},
root: 'features',
fields: [{
name: 'SiteName',
mapping: 'properties.SiteName'
}, {
name: 'Municipal',
mapping: 'properties.Municipal'
}, {
name: 'Commodity',
mapping: 'properties.Commodity'
}, {
name: 'Status',
mapping: 'properties.Status'
}, {
name: 'Longitude',
mapping: 'properties.Longitude'
}, {
name: 'Latitude',
mapping: 'properties.Latitude'
},{
name: 'bbox',
mapping: 'properties.bbox'
}],
sortInfo: {
field: "Municipal",
direction: "ASC"
}
});
ComboBox
var panelSiteNameSearch = new Ext.form.ComboBox({
store: dsm,
fieldLabel: "<b>Search</b>",
queryParam: "cql_filter",
queryTpl: "SiteName Like '{0}%'",
minChars: 5,
displayField: "SiteName",
valueField: "SiteName",
typeAhead: false,
loadingText: "Searching...",
width: 230,
emptyText: "Mine/Mineral Site Search",
hideTrigger: true,
tpl: '<tpl for="."><div class="search-item"><b>Site Name:</b> {SiteName}<br><b>Commodity: </b> {Commodity}<br><b>Municipality:</b> {Municipal}<br><b>Status:</b> {Status}</div><hr/></tpl>',
itemSelector: "div.search-item",
listeners: {
"select": function (combo, record) {
mrdsprimary.setVisibility(true);
mrdssecondary.setVisibility(true);
mrdstertiary.setVisibility(true);
map.setCenter(new OpenLayers.LonLat(record.data.Longitude,record.data.Latitude),13);
},
"focus": function() {
keyboardnav.deactivate();
},
"blur": function() {
keyboardnav.activate();
}
}
});
Я добавил panelSiteNameSearch.store.removeAll(); сразу после map.setCenter, и теперь я могу продолжать запрашивать хранилище столько, сколько захочу, а ComboBox работает так, как и должно быть независимо от размера JVM **, но все GetFeatureInfo и любой слой, использующий GeoWebCache, все еще полностью прекращают работу ** –