Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resetting zone allocator with allocations still alive

Tags:

swift

I'm receiving the following message in XCode 10.2.1 after my ViewController with a MKMapView gets de-initialized.

[Memory] Resetting zone allocator with 24 allocations still alive

I'm using the following code in the ViewController to clean-up the MKMapView. It doesn't seem to matter if I do this or remove the delegate in the ViewDidDisappear event.

deinit {
    self.mapView.delegate = nil
}

Is this indicating an actual memory leak or something else I need to fix? It doesn't appear to be leaking memory after opening/closing the ViewController multiple times.

like image 684
WaitsAtWork Avatar asked May 09 '19 14:05

WaitsAtWork


1 Answers

Calling mapView.removeAnnotations(mapView.annotations) in the deinit fixed it for me. It was occurring only if there were clustered annotations and the map was being zoomed or panned right before deallocation.

like image 186
Saurabh G Avatar answered Oct 24 '22 20:10

Saurabh G