OpenLayers: In what cases should I destroy the map
OpenLayers.Map has three functions that look 开发者_如何学Clike being used for freeing memory: destroy(), unloadDestroy(), updateSizeDestroy() (link).
Am I supposed to explicitly call them or not? From the description of "unloadDestroy", for example, it seems that it is already called by something.
I'm looking something similar to Google Maps' GUnload, which is supposed to be run upon page unload event - is there something similar for OpenLayers?
In the source it looks like unloadDestroy is added as an event on map initialization, so unless you have a specific need to destroy the map before page unload you probably have nothing to worry about.
https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Map.js#L565
精彩评论