When a map is displayed, it regularly uses CPU every second or two (timers triggering requestAnimationFrames). In the Chrome task manager, a tab with a map view constantly bounces around 5% (from zero to ten). Unfortunately, even if the window is not active.
But I would at least expect to be able to stop this CPU usage by destroying the MapView, and/or the Map. But this does not seem to be the case. Detaching the MapView from it's container and releasing the view and the map does not stop the CPU usage. But perhaps I'm not stopping the map view properly (but I didn't notice any official documentation or sample about this). I can reproduce this with a sample in the sandbox (e.g. intro-mapview) by adding the following attempt to cleanup code.
setTimeout(() => { view.container = null view.map = null view = null map = null }, 10000)
This seems related to this discussion and the suggestion is that removing the container reference and releasing the references is all it should take. Removing the container reference from the view does do the majority of the detach of the canvas and surface from the dom, but there seems to be a reference keeping the timers firing and reacting. How can we fully release the view?
Kris
Kris,
Have you seen this thread? How to remove the 2d map from the dom
There was a bug with mapview at one point, which should have been fixed, per Esri discussions. Is it possible there are still issues with destroying completely?
Chris,
Yes. I referenced that discussion in my post with "This seems related to this discussion...". There definitely does appear to still be issue (or regession) with the map destroying. I was hoping to find some way to force it.
Kris