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

Eric Lemoine eric.c2c at gmail.com
Thu Mar 26 15:31:21 EDT 2009


Hi. I agree that there's no way to control when memory is released,
but I've always thought the js engine takes case of garbage collecting
unreferenced objects. Are you sure the mem footprint of a page (within
a load) never decreases?

Eric

2009/3/26, Christopher Schmidt <crschmidt at metacarta.com>:
> On Thu, Mar 26, 2009 at 12:07:42PM -0700, TrevorQuinn wrote:
>>
>> 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.
>
> This is, I believe, expected behavior in all browser environments;
> memory is primarily released across page loads. Within page loads, there
> is little to no way to ensure that objects are released, as far as I'm
> aware.
>
> -- Chris
>
>> 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.
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Envoyé avec mon mobile



More information about the Users mailing list