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

Christopher Schmidt crschmidt at metacarta.com
Thu Mar 26 16:10:57 EDT 2009


On Thu, Mar 26, 2009 at 08:31:21PM +0100, Eric Lemoine wrote:
> 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?

No, not 'never', but "not controllable from Javascript" -- that is, we
can do things in Javascript to make sure that objects are cleaned up
across page loads -- by delinking from the DOM, etc., which is what our
destroy methods do -- but we can't do anything better than we already
are *inside* a page load: if the objects don't stick around across page
loads as monitored by something like Drip, then there is not much more
we can do.

That's my understanding, anyway.

-- Chris

> 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

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list