MKMapView leaks memory

Originator:toto.tvalavadze
Number:rdar://33400943 Date Originated:19-Jul-2017 22:02
Status:Open Resolved:
Product:iOS + SDK Product Version:11.0 (15A5318g)
Classification:Serious Bug Reproducible:Always
 
Summary:
MKMapView leaks memory when dismissed from visible view (or UICollectionViewCell, UITableViewCell, etc.)

Steps to Reproduce:
1. Add MKMapView to UIView as a subview. 
2. Present view on screen.
3. Dismiss view from screen.
4. Memory allocated by MKMapView is not being reclaimed.

Expected Results:
MKMapView allocated memory should be freed.

Actual Results:
Only ~20% of memory allocated by MKMapView after it was shown is reclaimed.

Version:
11.0 (15A5318g)

Notes:
Calling following from deinit of owner helps to reclaim almost all of memory MKMapView allocated.

```
    func applyMapViewMemoryLeakFix() {
        switch mapView.mapType {
        case .standard, .mutedStandard:
            mapView.mapType = .satellite
        default:
            mapView.mapType = .standard
        }
        mapView.showsUserLocation = false
        mapView.delegate = nil
        mapView.removeFromSuperview()
        mapView = nil
    }
```

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!