[OpenLayers-Users] body onunload

Christopher Schmidt crschmidt at metacarta.com
Mon Oct 15 15:34:22 EDT 2007


On Mon, Oct 15, 2007 at 03:23:43PM -0400, Mick Jagger wrote:
> Hi,
> 	Looking through the examples I don't see any OpenLayers maps using a "body onunload" call to reduce memory leaks.  Is this necessary with OpenLayers?  If so, what is the proper method.

OpenLayers registers this event automatically, so no additional steps
should be neccesary. That said, I highly recommend investigating your
OpenLayers usage for memory leaks: although MetaCarta contributed some
amount of work to the effort of cleaning up memory leaks in the core
Map, WMS Layer, and Markers layers, there are undoubtably still many
cases that can be improved.

(The unload event itself is:

OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache,
false);

Registered in OpenLayers/Events.js)

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list