Using the Bing Maps control in a WP7 app can incur a rather large memory cost when compared to the rest of an app. Typically I see an initial cost of approximately 8 Mb to show a full screen map when the zoom level is set to 16. This is not a concern, and in my opinion this shouldn't be either. Whats interesting to see is whats happen under the covers from a network perspective and to see if I can see any correlation. None of the following has any scientific basis, more a set of observations.
This is very simple to do, all we need to do is configure the WIFI on the device and then reconfigure Fiddler for remote connections. You can find all the detailed required in this great post by Eric Law.
For the observations I used a modified version of the app from the 'How many pins...' post I did a couple of weeks ago. It only shows the map control it does not display any pins.
When the app is initially installed and run for the first time I'm observing the following network traffic in Fiddler:
You can see there are approximately 35 requests for tiles when the app initially starts, as expected the low resolution tiles are requested first followed by higher resolution. Interestingly the largest tile in png format is only 25 Kb in size.Even if we multiplied 35 by 25 we don't get anywhere near the 8 Mb figure. Infact it only totals about 875 Kb. What we have to remember is, PNG is a bitmapped image format employing a lossless compression format.
Lets see the cost of loading one of these single tiles into an Image control, shown below is the tile and the a test app which loads the tile into the Image control when button the is clicked. I've also stuck on a couple of memory counters.
You can see from loading the image explicitly there is a memory cost associated approximately 600 Kb for this tile. If this was multipled by 25 we'd get a total memory cost of 15 Mb. This is a theoretical total figure but even if it was approaching half this size for the tiles downloaded in the Fiddler screenshot you can see the Bing Maps control is already managing the memory allocated internal already without even approaching the 90 Mb limit.
The next observation was around restarting the application. I observed the tiles were being cached for the app. Whether these are cached by the control for all apps or on a per app basis is unclear. Each response for a tile has HTTP caching directives and these state the tile can be cached for a year - 365 days. The screenshot show 2 restarts of the application, once immediately after closing the app and the second after rebooting the device.
The final observation is the most obvious as I scroll & zoom in and out of the map, I see alot of requests for tiles as expected, the interesting part is it appears the control makes maximum of 5 simultaneous requests for tiles. This was pretty hard to capture but the following screenshot shows 3 outstsanding requests:
This is very simple to do, all we need to do is configure the WIFI on the device and then reconfigure Fiddler for remote connections. You can find all the detailed required in this great post by Eric Law.
For the observations I used a modified version of the app from the 'How many pins...' post I did a couple of weeks ago. It only shows the map control it does not display any pins.
When the app is initially installed and run for the first time I'm observing the following network traffic in Fiddler:
You can see there are approximately 35 requests for tiles when the app initially starts, as expected the low resolution tiles are requested first followed by higher resolution. Interestingly the largest tile in png format is only 25 Kb in size.Even if we multiplied 35 by 25 we don't get anywhere near the 8 Mb figure. Infact it only totals about 875 Kb. What we have to remember is, PNG is a bitmapped image format employing a lossless compression format.
Lets see the cost of loading one of these single tiles into an Image control, shown below is the tile and the a test app which loads the tile into the Image control when button the is clicked. I've also stuck on a couple of memory counters.
You can see from loading the image explicitly there is a memory cost associated approximately 600 Kb for this tile. If this was multipled by 25 we'd get a total memory cost of 15 Mb. This is a theoretical total figure but even if it was approaching half this size for the tiles downloaded in the Fiddler screenshot you can see the Bing Maps control is already managing the memory allocated internal already without even approaching the 90 Mb limit.
The next observation was around restarting the application. I observed the tiles were being cached for the app. Whether these are cached by the control for all apps or on a per app basis is unclear. Each response for a tile has HTTP caching directives and these state the tile can be cached for a year - 365 days. The screenshot show 2 restarts of the application, once immediately after closing the app and the second after rebooting the device.
The final observation is the most obvious as I scroll & zoom in and out of the map, I see alot of requests for tiles as expected, the interesting part is it appears the control makes maximum of 5 simultaneous requests for tiles. This was pretty hard to capture but the following screenshot shows 3 outstsanding requests:
Comments
Post a Comment