Mapbox NavigationViewController not freeing up memory

38 Views Asked by At

On real device iPhone Xr iOS 17.2.1 after presenting NavigationViewController memory usage rises from 105mb to 229mb, after dismissing drops down to 147mb and after further opening and dismissing it ranges between from about 147mb(dismissed) to about 220mb(NavigationViewController presented)

I have debugged with memory graph, there are signs of Mapbox objects, but no sign of NavigationViewController. enter image description here

Well my question is now why does app still use about 40mb more memory after map is first used

I have just simplified my issue to the following code

let options = NavigationRouteOptions(coordinates: [
    CLLocationCoordinate2D(latitude: 40.71750, longitude: -74.00339),
    CLLocationCoordinate2D(latitude: 40.72427, longitude: -74.00275)
])

Directions.shared.calculate(options) { [weak self] (_, result) in
    switch result {
    case .failure(let error):
        print(error.localizedDescription)
    case .success(let response):
        guard let self else { return }
        
        let indexedRouteResponse = IndexedRouteResponse(routeResponse: response,
                                                        routeIndex: 0)
        let navigationService = MapboxNavigationService(indexedRouteResponse: indexedRouteResponse,
                                                        customRoutingProvider: NavigationSettings.shared.directions,
                                                        credentials: NavigationSettings.shared.directions.credentials,
                                                        simulating: .always)
        
        let viewController = NavigationViewController(for: indexedRouteResponse)
        self.present(viewController, animated: true, completion: nil)
    }
}

anybody facing this issue?

Xcode 15.2

enter image description here

0

There are 0 best solutions below