[OpenLayers-Users] WFS, memory, and IE 7/8

TrevorQuinn trevor.quinn at gmail.com
Thu Mar 26 15:07:42 EDT 2009


I've got an OpenLayers application that uses WFS heavily, and I see a steady increase in the memory footprint of IE7 and IE8 over time when I use the application. 

Memory usage grows when new WFS features and attributes are loaded, which happens each time the users pans or zooms to a new area. I'd like the application to discard all the previous view's features and free up resources each time the map is panned or zoomed, but it doesn't look like this is happening, despite a call to WFS.destroyFeatures(). As the user pans and zooms, memory usage always goes up, never down.

As an experiment, I tried to create a simple map with a WFS layer and a button that destroys and rebuilds the map (code snippet below). Each time I click the button, memory use goes up in IE7 and IE8. It looks like the map resources are never released.

Can anyone offer suggestions on how to free up memory when using WFS with Internet Explorer?

Code snippet:

var init = function() {
	...
	this.olMap = new OpenLayers.Map('map', this.mapOptions);
	this.olMap.addLayer(this.wms);
	this.olMap.addLayer(this.wfs);
	var bounds = new OpenLayers.Bounds(-13617640.95107214, 4551675.8443209315,
		-13608257.831193173, 4558220.8066184);
	this.olMap.zoomToExtent(bounds);	
};

var redraw = function() {
	this.wfs.destroyFeatures();
	this.wfs.destroy();
	this.wms.destroy();
	this.olMap.destroy();
	this.init();
};

...

<body onload="init();">

<div id="map" style="height: 700px; width: 1000px"></div>

<form>
<input type="button" onclick="redraw();" name="Redraw" value="Redraw" />
</form>

</body>
-- 
View this message in context: http://n2.nabble.com/WFS%2C-memory%2C-and-IE-7-8-tp2540478p2540478.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list