swiftmemory-leaksmkmapviewmapkitinstruments

MKMapView Instruments Memory Leak in iOS10


I've created a test project to track down a leak I'm seeing in Instruments when using MKMapView.

Here is my MapViewController code:

import UIKit
import MapKit

class MapViewController: UIViewController {

    @IBOutlet var mapView: MKMapView!

    deinit {
        print(#file, #function)
    }

}

When I dismiss this VC, the deinit line prints, but Instruments logs a memory leak. (Note: I'm testing on a device, not the simulator.) The deinit tells me the mapView was deallocated properly, so I don't understand why I have a memory leak unless it's a leak in Apple's code. Here's the Instruments screenshot.

Instruments Screenshot :-

Screenshot

For those curious, tracking the leak in Instruments displays the other VC in the test project, which is empty. Below is a screenshot of that.

Code leak pointer in Instruments:-

ScreenShot

Is there an issue with my code, or is it an Apple code leak? TIA


Solution

  • This was a bug and had been reported to Apple. It appears to have been corrected in iOS 11.