Memory crash issues for custom tiled layers. Slow rendering?

4193
2
12-13-2014 02:34 AM
RudolfKopriva1
New Contributor

Hello,

We have a map with 6 custom tiled layers. Tiles are loaded from a local storage. I might be wrong, but it looks like tiles are loaded faster than the map is able to render, so when we do a lot of paning/zooming the map renderer is accumulating images and the application crashes because of memory warnings. It's more markable when profiling, because the rendering is very slower there. Is there any queue for the map renderer? Can we check how many images are in the renderer's queue or do you have any idea how to avoid memory warnings?

Maybe a related issue is that a tiled layer is requesting more tiles than needed. From the documentation it should be only requesting tiles for the visible map extent when the bufferFactor is set to 1 (default value), however it's requesting much more tiles. It looks like the loading tiles extent is always 200% of the visible map extent. We see the same problem on Android where we also have memory warnings.

Thank you.

0 Kudos
2 Replies
RudolfKopriva1
New Contributor

It looks like each layer has it's own textures buffer, at least inside the OpenGL. That buffer probably contains images (textures), which are not neccessary removed from the memory when the image is removed from the map. It's because of the OpenGL uses that textures as placeholders in the memory. These textures can be tracked in the Instruments Tool when you enable Automatic Snapshotting for VM Tracker. You can see them as dirty IOKit objects as it's described here: Tracking IOKit Dirty Memory in iOS using Instruments - Wulf

The only time I found when these dirty textures are released from the memory is when the layer is removed from the map.

The lethal implication for our application is that we can only load a limitted number of layers at the same time. Any idea how to limit the number of textures or how to release them?

0 Kudos
RudolfKopriva1
New Contributor

Attached is a sample, which is based on the CustomTiledLayerSample project.

It has 5 layers and it's crashing on iPhone 4S before these layers load. Tiles are loaded one by one and there is a 300ms delay before next tile is loaded. You don't have to zoom or pan, it will crash automatically. Attached is a screenshot of memory usage.

Instruments are displaying a lot of dirty memory, but I'm not sure how so many memory can be dirty when the map is not zooming or panning.

When I call refresh on a layer then the memory is released, so it looks like all that memory is for loaded images.

Do you have any ideas how to reduce the memory usage without removing layers?

Thanks.

0 Kudos