Application size with loading Apple MAP

2019-07-11 18:25发布

问题:

I am struggling with a problem that looks like simple but it is making the app run size to 30-35 MB. The app is ARC enabled. Here is the scenario.

1) I invoke a UIViewcontroller from within my method (the viewController instance is local to the method)& after pushing it to NavigationController I am setting the local instance as nil.

    btMapViewController *routeMap = [[btMapViewController alloc]init];
        [routeMap setSourcLocation:[txtsource text]];
        [routeMap setDestinationLocation:[txtDestination text]];
        [routeMap setNightFareOn:addNightCharge];
        [self.navigationController pushViewController:routeMap animated:YES];
        routeMap = nil;

2) The newly pushed controller initializes a MKMapView & plot the routes on it. The app now runs on a memory of 35-40 MB which is 5 times more than what it was running before step 1.

@interface btMapViewController ()
@property(nonatomic, strong) MKMapView *mapView;
@end

3) Now if I pop out the UIViewcontroller (the one loaded in step 1), the app runs on a memory of 30-34 MB.

I check the Memory trace, its clear. Then who is holding the memory ?

Is that the MKMap is the part of Interface Implementation is leading to this problem or shall I make it private to the btMapViewController class. ?