Post

Replies

Boosts

Views

Activity

MapView remove polyline overlay, memory leak on IOS 14.2
I need to remove a Polyline and replace it by a new one on my mapView about every 2 seconds. The Polyline is correctly removed and added to the screen so that is great. But I see the app memory use increase by about 5 mb per minute. This results in the app becoming very slow and unresponsive. I see the problem on the IOS 14.2 simulator and hardware (iPhone and iPad). On my 13.4 simulator this problem does occur and all works fine without memory leaking. Below run the the steps to reproduce in a loop: 1 create a regular polyLine with about 50 entries polyLine.title = "polyLine" 2 mapView.addOverlay(PolyLine) 3 let allOverlays = mapView.overlays for overlay in allOverlays { if (overlay.title == "polyLine") {     mapView.removeOverlay(overlay)   } } 4 mapView.addOverlay(PolyLine) Note: I see the same problem when navigation routes (that is also using Polyline overlay) are recreated. So it looks like MapView graphically works ok but is not releasing memory after mapView.removeOverlay(overlay) is called. Here is some output from instruments/leaks pointing to VectorKit: MTLSimTexture 4048 < multiple > 1,48 MiB MTLSimDriver _77-[MTLSimTexture newTextureViewWithPixelFormatInternal:isInternalTextureView:]block_invoke Malloc 16 Bytes 4083 < multiple > 63,80 KiB VectorKit geo::MallocZoneAllocator::allocate(unsigned long, unsigned long) Malloc 144 Bytes 4105 < multiple > 577,27 KiB VectorKit geo::MallocZoneAllocator::allocate(unsigned long, unsigned long)
10
0
3.6k
Feb ’22