[OpenLayers-Users] the right way to refresh a text layer?

Eric Lemoine eric.c2c at gmail.com
Sun Dec 2 15:03:53 EST 2007


On Dec 2, 2007 7:41 PM, Michal Rok <mrok at mrok.com> wrote:
>
>
>
> Hi,
>
> Somewhere in my code I have a function that is supposed to destroy and
> re-create a Text layer to display up-to-date information:
>
> function refresh_markers() {
>  map.removeLayer(markers);
>  markers.destroy();
>  markers = new OpenLayers.Layer.Text( "Test layer", {location:
> "maps/aircraft.csv?" +
>     new Date().getTime() } );
>  map.addLayer(markers);
> }
>
> This appears to leak memory - every time the layer is refreshed, by Explorer
> memory consumption grows by 5MB.
>
> What is the right way to refresh a text layer?

Your code looks correct.

Most probably you're hitting <http://trac.openlayers.org/ticket/1123>.
You can try the patch attached to this ticket to see if that makes the
memory leak go away. If so, we should definitely move forward with
that ticket.

Thanks,

--
Eric



More information about the Users mailing list